Add cache line recovery utils to OCF internal API
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
@@ -481,43 +481,6 @@ err:
|
||||
OCF_PL_FINISH_RET(pipeline, -OCF_ERR_START_CACHE_FAIL);
|
||||
}
|
||||
|
||||
static void _recovery_rebuild_cline_metadata(ocf_cache_t cache,
|
||||
ocf_core_id_t core_id, uint64_t core_line,
|
||||
ocf_cache_line_t cache_line)
|
||||
{
|
||||
ocf_core_t core = ocf_cache_get_core(cache, core_id);
|
||||
ocf_part_id_t part_id;
|
||||
ocf_cache_line_t hash_index;
|
||||
struct ocf_part_runtime *part;
|
||||
|
||||
part_id = PARTITION_DEFAULT;
|
||||
part = cache->user_parts[part_id].part.runtime;
|
||||
|
||||
ocf_metadata_set_partition_id(cache, cache_line, part_id);
|
||||
env_atomic_inc(&part->curr_size);
|
||||
|
||||
hash_index = ocf_metadata_hash_func(cache, core_line, core_id);
|
||||
ocf_metadata_add_to_collision(cache, core_id, core_line, hash_index,
|
||||
cache_line);
|
||||
|
||||
ocf_lru_init_cline(cache, cache_line);
|
||||
|
||||
ocf_lru_add(cache, cache_line);
|
||||
|
||||
env_atomic_inc(&core->runtime_meta->cached_clines);
|
||||
env_atomic_inc(&core->runtime_meta->
|
||||
part_counters[part_id].cached_clines);
|
||||
|
||||
if (metadata_test_dirty(cache, cache_line)) {
|
||||
env_atomic_inc(&core->runtime_meta->dirty_clines);
|
||||
env_atomic_inc(&core->runtime_meta->
|
||||
part_counters[part_id].dirty_clines);
|
||||
if (!env_atomic64_read(&core->runtime_meta->dirty_since))
|
||||
env_atomic64_cmpxchg(&core->runtime_meta->dirty_since, 0,
|
||||
env_ticks_to_secs(env_get_tick_count()));
|
||||
}
|
||||
}
|
||||
|
||||
static void _recovery_reset_cline_metadata(struct ocf_cache *cache,
|
||||
ocf_cache_line_t cline)
|
||||
{
|
||||
@@ -546,7 +509,7 @@ static void _ocf_mngt_recovery_rebuild_metadata(ocf_cache_t cache)
|
||||
(!dirty_only || metadata_test_dirty(cache,
|
||||
cline))) {
|
||||
/* Rebuild metadata for mapped cache line */
|
||||
_recovery_rebuild_cline_metadata(cache, core_id,
|
||||
ocf_cline_rebuild_metadata(cache, core_id,
|
||||
core_line, cline);
|
||||
if (dirty_only)
|
||||
metadata_clear_valid_if_clean(cache, cline);
|
||||
|
Reference in New Issue
Block a user