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:
@@ -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_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;
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -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_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;
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1017,7 +1017,7 @@ void ocf_cleaner_refcnt_freeze(ocf_cache_t cache)
|
||||
ocf_part_id_t 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)
|
||||
@@ -1026,7 +1026,7 @@ void ocf_cleaner_refcnt_unfreeze(ocf_cache_t cache)
|
||||
ocf_part_id_t 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)
|
||||
@@ -1050,7 +1050,7 @@ void ocf_cleaner_refcnt_register_zero_cb(ocf_cache_t cache,
|
||||
|
||||
for_each_part(cache, curr_part, part_id) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
@@ -142,7 +142,7 @@ void ocf_part_move(struct ocf_request *req)
|
||||
ocf_metadata_add_to_partition(cache, id_new, line);
|
||||
|
||||
/* 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);
|
||||
|
||||
/* Check if cache line is dirty. If yes then need to change
|
||||
|
Reference in New Issue
Block a user