Refactor LRU code to use part rather than part_id

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
Adam Rutkowski 2020-11-30 20:27:40 +01:00
parent 41a767de97
commit 44efe3e49e
13 changed files with 58 additions and 59 deletions

View File

@ -266,7 +266,7 @@ static void ocf_engine_map_cache_line(struct ocf_request *req,
*cache_line); *cache_line);
ocf_metadata_end_collision_shared_access(cache, *cache_line); ocf_metadata_end_collision_shared_access(cache, *cache_line);
ocf_eviction_init_cache_line(cache, *cache_line, part_id); ocf_eviction_init_cache_line(cache, *cache_line);
/* Update LRU:: Move this node to head of lru list. */ /* Update LRU:: Move this node to head of lru list. */
ocf_eviction_set_hot_cache_line(cache, *cache_line); ocf_eviction_set_hot_cache_line(cache, *cache_line);

View File

@ -42,11 +42,10 @@ static uint32_t ocf_evict_calculate(struct ocf_user_part *part,
static inline uint32_t ocf_evict_do(ocf_cache_t cache, static inline uint32_t ocf_evict_do(ocf_cache_t cache,
ocf_queue_t io_queue, const uint32_t evict_cline_no, ocf_queue_t io_queue, const uint32_t evict_cline_no,
ocf_part_id_t target_part_id) struct ocf_user_part *target_part)
{ {
uint32_t to_evict = 0, evicted = 0; uint32_t to_evict = 0, evicted = 0;
struct ocf_user_part *part; struct ocf_user_part *part;
struct ocf_user_part *target_part = &cache->user_parts[target_part_id];
ocf_part_id_t part_id; ocf_part_id_t part_id;
/* For each partition from the lowest priority to highest one */ /* For each partition from the lowest priority to highest one */
@ -68,7 +67,7 @@ static inline uint32_t ocf_evict_do(ocf_cache_t cache,
/* It seams that no more partition for eviction */ /* It seams that no more partition for eviction */
break; break;
} }
if (part_id == target_part_id) { if (part_id == target_part->id) {
/* Omit targeted, evict from different first */ /* Omit targeted, evict from different first */
continue; continue;
} }
@ -84,7 +83,7 @@ static inline uint32_t ocf_evict_do(ocf_cache_t cache,
} }
evicted += ocf_eviction_need_space(cache, io_queue, evicted += ocf_eviction_need_space(cache, io_queue,
part_id, to_evict); part, to_evict);
} }
if (!ocf_eviction_can_evict(cache)) if (!ocf_eviction_can_evict(cache))
@ -95,7 +94,7 @@ static inline uint32_t ocf_evict_do(ocf_cache_t cache,
to_evict = ocf_evict_calculate(target_part, evict_cline_no); to_evict = ocf_evict_calculate(target_part, evict_cline_no);
if (to_evict) { if (to_evict) {
evicted += ocf_eviction_need_space(cache, io_queue, evicted += ocf_eviction_need_space(cache, io_queue,
target_part_id, to_evict); target_part, to_evict);
} }
} }
@ -108,14 +107,14 @@ int space_managment_evict_do(struct ocf_cache *cache,
{ {
uint32_t evicted; uint32_t evicted;
uint32_t free; uint32_t free;
struct ocf_user_part *req_part = &cache->user_parts[req->part_id];
free = ocf_freelist_num_free(cache->freelist); free = ocf_freelist_num_free(cache->freelist);
if (evict_cline_no <= free) if (evict_cline_no <= free)
return LOOKUP_MAPPED; return LOOKUP_MAPPED;
evict_cline_no -= free; evict_cline_no -= free;
evicted = ocf_evict_do(cache, req->io_queue, evict_cline_no, evicted = ocf_evict_do(cache, req->io_queue, evict_cline_no, req_part);
req->part_id);
if (evict_cline_no <= evicted) if (evict_cline_no <= evicted)
return LOOKUP_MAPPED; return LOOKUP_MAPPED;

View File

@ -16,6 +16,8 @@
#define OCF_NUM_EVICTION_LISTS 32 #define OCF_NUM_EVICTION_LISTS 32
struct ocf_user_part;
struct eviction_policy { struct eviction_policy {
union { union {
struct lru_eviction_policy lru; struct lru_eviction_policy lru;
@ -39,16 +41,16 @@ struct eviction_policy_ops {
ocf_cache_line_t cline); ocf_cache_line_t cline);
bool (*can_evict)(ocf_cache_t cache); bool (*can_evict)(ocf_cache_t cache);
uint32_t (*req_clines)(ocf_cache_t cache, uint32_t (*req_clines)(ocf_cache_t cache,
ocf_queue_t io_queue, ocf_part_id_t part_id, ocf_queue_t io_queue, struct ocf_user_part *part,
uint32_t cline_no); uint32_t cline_no);
void (*hot_cline)(ocf_cache_t cache, void (*hot_cline)(ocf_cache_t cache,
ocf_cache_line_t cline); ocf_cache_line_t cline);
void (*init_evp)(ocf_cache_t cache, ocf_part_id_t part_id); void (*init_evp)(ocf_cache_t cache, struct ocf_user_part *part);
void (*dirty_cline)(ocf_cache_t cache, void (*dirty_cline)(ocf_cache_t cache,
ocf_part_id_t part_id, struct ocf_user_part *part,
uint32_t cline_no); uint32_t cline_no);
void (*clean_cline)(ocf_cache_t cache, void (*clean_cline)(ocf_cache_t cache,
ocf_part_id_t part_id, struct ocf_user_part *part,
uint32_t cline_no); uint32_t cline_no);
const char *name; const char *name;
}; };

View File

@ -191,9 +191,8 @@ void evp_lru_rm_cline(ocf_cache_t cache, ocf_cache_line_t cline)
} }
static inline void lru_iter_init(struct ocf_lru_iter *iter, ocf_cache_t cache, static inline void lru_iter_init(struct ocf_lru_iter *iter, ocf_cache_t cache,
ocf_part_id_t part_id, uint32_t start_evp, bool clean) struct ocf_user_part *part, uint32_t start_evp, bool clean)
{ {
struct ocf_user_part *part = &cache->user_parts[part_id];
uint32_t i; uint32_t i;
/* entire iterator implementation depends on gcc builtins for /* entire iterator implementation depends on gcc builtins for
@ -201,7 +200,6 @@ static inline void lru_iter_init(struct ocf_lru_iter *iter, ocf_cache_t cache,
ENV_BUILD_BUG_ON(OCF_NUM_EVICTION_LISTS > sizeof(iter->evp) * 8); ENV_BUILD_BUG_ON(OCF_NUM_EVICTION_LISTS > sizeof(iter->evp) * 8);
iter->cache = cache; iter->cache = cache;
iter->part_id = part_id;
iter->part = part; iter->part = part;
/* set iterator value to start_evp - 1 modulo OCF_NUM_EVICTION_LISTS */ /* set iterator value to start_evp - 1 modulo OCF_NUM_EVICTION_LISTS */
iter->evp = (start_evp + OCF_NUM_EVICTION_LISTS - 1) % OCF_NUM_EVICTION_LISTS; iter->evp = (start_evp + OCF_NUM_EVICTION_LISTS - 1) % OCF_NUM_EVICTION_LISTS;
@ -273,7 +271,7 @@ static void evp_lru_clean_end(void *private_data, int error)
{ {
struct ocf_lru_iter *iter = private_data; struct ocf_lru_iter *iter = private_data;
ocf_refcnt_dec(&iter->cache->refcnt.cleaning[iter->part_id]); ocf_refcnt_dec(&iter->part->cleaning);
} }
static int evp_lru_clean_getter(ocf_cache_t cache, void *getter_context, static int evp_lru_clean_getter(ocf_cache_t cache, void *getter_context,
@ -303,10 +301,9 @@ static int evp_lru_clean_getter(ocf_cache_t cache, void *getter_context,
} }
static void evp_lru_clean(ocf_cache_t cache, ocf_queue_t io_queue, static void evp_lru_clean(ocf_cache_t cache, ocf_queue_t io_queue,
ocf_part_id_t part_id, uint32_t count) struct ocf_user_part *part, uint32_t count)
{ {
struct ocf_refcnt *counter = &cache->refcnt.cleaning[part_id]; struct ocf_refcnt *counter = &part->cleaning;
struct ocf_user_part *part = &cache->user_parts[part_id];
struct ocf_cleaner_attribs attribs = { struct ocf_cleaner_attribs attribs = {
.cache_line_lock = true, .cache_line_lock = true,
.do_sort = true, .do_sort = true,
@ -337,7 +334,7 @@ static void evp_lru_clean(ocf_cache_t cache, ocf_queue_t io_queue,
return; return;
} }
lru_iter_init(&part->eviction_clean_iter, cache, part_id, lru_iter_init(&part->eviction_clean_iter, cache, part,
part->eviction_clean_iter.evp, false); part->eviction_clean_iter.evp, false);
ocf_cleaner_fire(cache, &attribs); ocf_cleaner_fire(cache, &attribs);
@ -387,11 +384,9 @@ bool evp_lru_can_evict(ocf_cache_t cache)
return true; return true;
} }
static bool dirty_pages_present(ocf_cache_t cache, ocf_part_id_t part_id) static bool dirty_pages_present(ocf_cache_t cache, struct ocf_user_part *part)
{ {
uint32_t i; uint32_t i;
struct ocf_user_part *part = &cache->user_parts[part_id];
for (i = 0; i < OCF_NUM_EVICTION_LISTS; i++) { for (i = 0; i < OCF_NUM_EVICTION_LISTS; i++) {
if (evp_lru_get_list(part, i, false)->tail != end_marker) if (evp_lru_get_list(part, i, false)->tail != end_marker)
@ -403,17 +398,16 @@ static bool dirty_pages_present(ocf_cache_t cache, ocf_part_id_t part_id)
/* the caller must hold the metadata lock */ /* the caller must hold the metadata lock */
uint32_t evp_lru_req_clines(ocf_cache_t cache, ocf_queue_t io_queue, uint32_t evp_lru_req_clines(ocf_cache_t cache, ocf_queue_t io_queue,
ocf_part_id_t part_id, uint32_t cline_no) struct ocf_user_part *part, uint32_t cline_no)
{ {
struct ocf_lru_iter iter; struct ocf_lru_iter iter;
uint32_t i; uint32_t i;
ocf_cache_line_t cline; ocf_cache_line_t cline;
struct ocf_user_part *part = &cache->user_parts[part_id];
if (cline_no == 0) if (cline_no == 0)
return 0; return 0;
lru_iter_init(&iter, cache, part_id, part->next_eviction_list, true); lru_iter_init(&iter, cache, part, part->next_eviction_list, true);
i = 0; i = 0;
while (i < cline_no) { while (i < cline_no) {
@ -451,8 +445,8 @@ uint32_t evp_lru_req_clines(ocf_cache_t cache, ocf_queue_t io_queue,
part->next_eviction_list = iter.evp; part->next_eviction_list = iter.evp;
if (i < cline_no && dirty_pages_present(cache, part_id)) if (i < cline_no && dirty_pages_present(cache, part))
evp_lru_clean(cache, io_queue, part_id, cline_no - i); evp_lru_clean(cache, io_queue, part, cline_no - i);
/* Return number of clines that were really evicted */ /* Return number of clines that were really evicted */
return i; return i;
@ -484,9 +478,8 @@ static inline void _lru_init(struct ocf_lru_list *list)
list->tail = end_marker; list->tail = end_marker;
} }
void evp_lru_init_evp(ocf_cache_t cache, ocf_part_id_t part_id) void evp_lru_init_evp(ocf_cache_t cache, struct ocf_user_part *part)
{ {
struct ocf_user_part *part = &cache->user_parts[part_id];
struct ocf_lru_list *clean_list; struct ocf_lru_list *clean_list;
struct ocf_lru_list *dirty_list; struct ocf_lru_list *dirty_list;
uint32_t i; uint32_t i;
@ -500,10 +493,9 @@ void evp_lru_init_evp(ocf_cache_t cache, ocf_part_id_t part_id)
} }
} }
void evp_lru_clean_cline(ocf_cache_t cache, ocf_part_id_t part_id, void evp_lru_clean_cline(ocf_cache_t cache, struct ocf_user_part *part,
uint32_t cline) uint32_t cline)
{ {
struct ocf_user_part *part = &cache->user_parts[part_id];
uint32_t ev_list = (cline % OCF_NUM_EVICTION_LISTS); uint32_t ev_list = (cline % OCF_NUM_EVICTION_LISTS);
struct ocf_lru_list *clean_list; struct ocf_lru_list *clean_list;
struct ocf_lru_list *dirty_list; struct ocf_lru_list *dirty_list;
@ -517,10 +509,9 @@ void evp_lru_clean_cline(ocf_cache_t cache, ocf_part_id_t part_id,
OCF_METADATA_EVICTION_UNLOCK(cline); OCF_METADATA_EVICTION_UNLOCK(cline);
} }
void evp_lru_dirty_cline(ocf_cache_t cache, ocf_part_id_t part_id, void evp_lru_dirty_cline(ocf_cache_t cache, struct ocf_user_part *part,
uint32_t cline) uint32_t cline)
{ {
struct ocf_user_part *part = &cache->user_parts[part_id];
uint32_t ev_list = (cline % OCF_NUM_EVICTION_LISTS); uint32_t ev_list = (cline % OCF_NUM_EVICTION_LISTS);
struct ocf_lru_list *clean_list; struct ocf_lru_list *clean_list;
struct ocf_lru_list *dirty_list; struct ocf_lru_list *dirty_list;

View File

@ -8,14 +8,18 @@
#include "eviction.h" #include "eviction.h"
#include "lru_structs.h" #include "lru_structs.h"
struct ocf_user_part;
void evp_lru_init_cline(struct ocf_cache *cache, ocf_cache_line_t cline); void evp_lru_init_cline(struct ocf_cache *cache, ocf_cache_line_t cline);
void evp_lru_rm_cline(struct ocf_cache *cache, ocf_cache_line_t cline); void evp_lru_rm_cline(struct ocf_cache *cache, ocf_cache_line_t cline);
bool evp_lru_can_evict(struct ocf_cache *cache); bool evp_lru_can_evict(struct ocf_cache *cache);
uint32_t evp_lru_req_clines(struct ocf_cache *cache, ocf_queue_t io_queue, uint32_t evp_lru_req_clines(struct ocf_cache *cache, ocf_queue_t io_queue,
ocf_part_id_t part_id, uint32_t cline_no); struct ocf_user_part *part, uint32_t cline_no);
void evp_lru_hot_cline(struct ocf_cache *cache, ocf_cache_line_t cline); void evp_lru_hot_cline(struct ocf_cache *cache, ocf_cache_line_t cline);
void evp_lru_init_evp(struct ocf_cache *cache, ocf_part_id_t part_id); void evp_lru_init_evp(struct ocf_cache *cache, struct ocf_user_part *part);
void evp_lru_dirty_cline(struct ocf_cache *cache, ocf_part_id_t part_id, uint32_t cline); void evp_lru_dirty_cline(struct ocf_cache *cache, struct ocf_user_part *part,
void evp_lru_clean_cline(struct ocf_cache *cache, ocf_part_id_t part_id, uint32_t cline); uint32_t cline);
void evp_lru_clean_cline(struct ocf_cache *cache, struct ocf_user_part *part,
uint32_t cline);
#endif #endif

View File

@ -16,7 +16,7 @@
* @note This operation is called under WR metadata lock * @note This operation is called under WR metadata lock
*/ */
static inline void ocf_eviction_init_cache_line(struct ocf_cache *cache, static inline void ocf_eviction_init_cache_line(struct ocf_cache *cache,
ocf_cache_line_t line, ocf_part_id_t part_id) ocf_cache_line_t line)
{ {
uint8_t type; uint8_t type;
@ -53,7 +53,8 @@ static inline bool ocf_eviction_can_evict(struct ocf_cache *cache)
} }
static inline uint32_t ocf_eviction_need_space(struct ocf_cache *cache, static inline uint32_t ocf_eviction_need_space(struct ocf_cache *cache,
ocf_queue_t io_queue, ocf_part_id_t part_id, uint32_t clines) ocf_queue_t io_queue, struct ocf_user_part *part,
uint32_t clines)
{ {
uint8_t type; uint8_t type;
uint32_t result = 0; uint32_t result = 0;
@ -68,7 +69,7 @@ static inline uint32_t ocf_eviction_need_space(struct ocf_cache *cache,
* eviction lock. * eviction lock.
*/ */
result = evict_policy_ops[type].req_clines(cache, io_queue, result = evict_policy_ops[type].req_clines(cache, io_queue,
part_id, clines); part, clines);
} }
return result; return result;
@ -89,7 +90,7 @@ static inline void ocf_eviction_set_hot_cache_line(
} }
static inline void ocf_eviction_initialize(struct ocf_cache *cache, static inline void ocf_eviction_initialize(struct ocf_cache *cache,
ocf_part_id_t part_id) struct ocf_user_part *part)
{ {
uint8_t type = cache->conf_meta->eviction_policy_type; uint8_t type = cache->conf_meta->eviction_policy_type;
@ -97,7 +98,7 @@ static inline void ocf_eviction_initialize(struct ocf_cache *cache,
if (likely(evict_policy_ops[type].init_evp)) { if (likely(evict_policy_ops[type].init_evp)) {
OCF_METADATA_EVICTION_LOCK_ALL(); OCF_METADATA_EVICTION_LOCK_ALL();
evict_policy_ops[type].init_evp(cache, part_id); evict_policy_ops[type].init_evp(cache, part);
OCF_METADATA_EVICTION_UNLOCK_ALL(); OCF_METADATA_EVICTION_UNLOCK_ALL();
} }
} }

View File

@ -563,6 +563,7 @@ int ocf_metadata_hash_init(struct ocf_cache *cache,
for (i = 0; i < OCF_IO_CLASS_MAX + 1; i++) { for (i = 0; i < OCF_IO_CLASS_MAX + 1; i++) {
cache->user_parts[i].config = &part_config[i]; cache->user_parts[i].config = &part_config[i];
cache->user_parts[i].runtime = &part_runtime[i]; cache->user_parts[i].runtime = &part_runtime[i];
cache->user_parts[i].id = i;
} }
/* Set core metadata */ /* Set core metadata */
@ -1949,7 +1950,7 @@ static void _recovery_rebuild_cline_metadata(ocf_cache_t cache,
ocf_metadata_add_to_collision(cache, core_id, core_line, hash_index, ocf_metadata_add_to_collision(cache, core_id, core_line, hash_index,
cache_line); cache_line);
ocf_eviction_init_cache_line(cache, cache_line, part_id); ocf_eviction_init_cache_line(cache, cache_line);
ocf_eviction_set_hot_cache_line(cache, cache_line); ocf_eviction_set_hot_cache_line(cache, cache_line);

View File

@ -38,8 +38,6 @@ struct ocf_user_part_runtime {
struct ocf_lru_iter { struct ocf_lru_iter {
/* cache object */ /* cache object */
ocf_cache_t cache; ocf_cache_t cache;
/* target partition id */
ocf_part_id_t part_id;
/* target partition */ /* target partition */
struct ocf_user_part *part; struct ocf_user_part *part;
/* per-partition cacheline iterator */ /* per-partition cacheline iterator */
@ -56,6 +54,8 @@ struct ocf_lru_iter {
struct ocf_user_part { struct ocf_user_part {
struct ocf_user_part_config *config; struct ocf_user_part_config *config;
struct ocf_user_part_runtime *runtime; struct ocf_user_part_runtime *runtime;
struct ocf_refcnt cleaning;
ocf_part_id_t id;
struct ocf_lru_iter eviction_clean_iter; struct ocf_lru_iter eviction_clean_iter;
uint32_t next_eviction_list; uint32_t next_eviction_list;

View File

@ -177,7 +177,7 @@ static void __init_partitions(ocf_cache_t cache)
/* Add other partition to the cache and make it as dummy */ /* Add other partition to the cache and make it as dummy */
for (i_part = 0; i_part < OCF_IO_CLASS_MAX; i_part++) { for (i_part = 0; i_part < OCF_IO_CLASS_MAX; i_part++) {
ocf_refcnt_freeze(&cache->refcnt.cleaning[i_part]); ocf_refcnt_freeze(&cache->user_parts[i_part].cleaning);
if (i_part == PARTITION_DEFAULT) if (i_part == PARTITION_DEFAULT)
continue; continue;
@ -191,14 +191,15 @@ static void __init_partitions(ocf_cache_t cache)
static void __init_partitions_attached(ocf_cache_t cache) static void __init_partitions_attached(ocf_cache_t cache)
{ {
struct ocf_user_part *part;
ocf_part_id_t part_id; ocf_part_id_t part_id;
for (part_id = 0; part_id < OCF_IO_CLASS_MAX; part_id++) { for (part_id = 0; part_id < OCF_IO_CLASS_MAX; part_id++) {
cache->user_parts[part_id].runtime->head = part = &cache->user_parts[part_id];
cache->device->collision_table_entries;
cache->user_parts[part_id].runtime->curr_size = 0;
ocf_eviction_initialize(cache, part_id); part->runtime->head = cache->device->collision_table_entries;
part->runtime->curr_size = 0;
ocf_eviction_initialize(cache, part);
} }
} }

View File

@ -122,8 +122,6 @@ struct ocf_cache {
/* # of requests accessing attached metadata, excluding /* # of requests accessing attached metadata, excluding
* management reqs */ * management reqs */
struct ocf_refcnt metadata; struct ocf_refcnt metadata;
/* # of forced cleaning requests (eviction path) */
struct ocf_refcnt cleaning[OCF_IO_CLASS_MAX];
} refcnt; } refcnt;
uint32_t fallback_pt_error_threshold; uint32_t fallback_pt_error_threshold;

View File

@ -101,6 +101,7 @@ void set_cache_line_clean(struct ocf_cache *cache, uint8_t start_bit,
{ {
ocf_cache_line_t line = req->map[map_idx].coll_idx; ocf_cache_line_t line = req->map[map_idx].coll_idx;
ocf_part_id_t part_id = ocf_metadata_get_partition_id(cache, line); ocf_part_id_t part_id = ocf_metadata_get_partition_id(cache, line);
struct ocf_user_part *part = &cache->user_parts[part_id];
uint8_t evp_type = cache->conf_meta->eviction_policy_type; uint8_t evp_type = cache->conf_meta->eviction_policy_type;
bool line_is_clean; bool line_is_clean;
@ -130,7 +131,7 @@ void set_cache_line_clean(struct ocf_cache *cache, uint8_t start_bit,
part_counters[part_id].dirty_clines); part_counters[part_id].dirty_clines);
if (likely(evict_policy_ops[evp_type].clean_cline)) if (likely(evict_policy_ops[evp_type].clean_cline))
evict_policy_ops[evp_type].clean_cline(cache, part_id, line); evict_policy_ops[evp_type].clean_cline(cache, part, line);
ocf_purge_cleaning_policy(cache, line); ocf_purge_cleaning_policy(cache, line);
} }
@ -143,6 +144,7 @@ void set_cache_line_dirty(struct ocf_cache *cache, uint8_t start_bit,
{ {
ocf_cache_line_t line = req->map[map_idx].coll_idx; ocf_cache_line_t line = req->map[map_idx].coll_idx;
ocf_part_id_t part_id = ocf_metadata_get_partition_id(cache, line); ocf_part_id_t part_id = ocf_metadata_get_partition_id(cache, line);
struct ocf_user_part *part = &cache->user_parts[part_id];
uint8_t evp_type = cache->conf_meta->eviction_policy_type; uint8_t evp_type = cache->conf_meta->eviction_policy_type;
bool line_was_dirty; bool line_was_dirty;
@ -170,7 +172,7 @@ void set_cache_line_dirty(struct ocf_cache *cache, uint8_t start_bit,
part_counters[part_id].dirty_clines); part_counters[part_id].dirty_clines);
if (likely(evict_policy_ops[evp_type].dirty_cline)) if (likely(evict_policy_ops[evp_type].dirty_cline))
evict_policy_ops[evp_type].dirty_cline(cache, part_id, line); evict_policy_ops[evp_type].dirty_cline(cache, part, line);
} }
} }

View File

@ -1017,7 +1017,7 @@ void ocf_cleaner_refcnt_freeze(ocf_cache_t cache)
ocf_part_id_t part_id; ocf_part_id_t part_id;
for_each_part(cache, curr_part, part_id) for_each_part(cache, curr_part, part_id)
ocf_refcnt_freeze(&cache->refcnt.cleaning[part_id]); ocf_refcnt_freeze(&curr_part->cleaning);
} }
void ocf_cleaner_refcnt_unfreeze(ocf_cache_t cache) void ocf_cleaner_refcnt_unfreeze(ocf_cache_t cache)
@ -1026,7 +1026,7 @@ void ocf_cleaner_refcnt_unfreeze(ocf_cache_t cache)
ocf_part_id_t part_id; ocf_part_id_t part_id;
for_each_part(cache, curr_part, part_id) for_each_part(cache, curr_part, part_id)
ocf_refcnt_unfreeze(&cache->refcnt.cleaning[part_id]); ocf_refcnt_unfreeze(&curr_part->cleaning);
} }
static void ocf_cleaner_refcnt_register_zero_cb_finish(void *priv) static void ocf_cleaner_refcnt_register_zero_cb_finish(void *priv)
@ -1050,7 +1050,7 @@ void ocf_cleaner_refcnt_register_zero_cb(ocf_cache_t cache,
for_each_part(cache, curr_part, part_id) { for_each_part(cache, curr_part, part_id) {
env_atomic_inc(&ctx->waiting); env_atomic_inc(&ctx->waiting);
ocf_refcnt_register_zero_cb(&cache->refcnt.cleaning[part_id], ocf_refcnt_register_zero_cb(&curr_part->cleaning,
ocf_cleaner_refcnt_register_zero_cb_finish, ctx); ocf_cleaner_refcnt_register_zero_cb_finish, ctx);
} }

View File

@ -142,7 +142,7 @@ void ocf_part_move(struct ocf_request *req)
ocf_metadata_add_to_partition(cache, id_new, line); ocf_metadata_add_to_partition(cache, id_new, line);
/* Add to new eviction */ /* Add to new eviction */
ocf_eviction_init_cache_line(cache, line, id_new); ocf_eviction_init_cache_line(cache, line);
ocf_eviction_set_hot_cache_line(cache, line); ocf_eviction_set_hot_cache_line(cache, line);
/* Check if cache line is dirty. If yes then need to change /* Check if cache line is dirty. If yes then need to change