Unify type of dirty_for
in info structs
Reformat function that calculates how long cache/core is dirty Update `dirty_for` types in functional tests Values stored in info structs fields (both in cache and core structs) are unsigned 64-bits ints but `dirty_for`s were unsigned 32-bits ints. Use existing function to transform returned value to seconds. Replace seconds stored in metadata with seconds. Replacement was done if old value of replaced field was equal to zero. Acquiring monotonic high precission timestamp is potentially slow and it makes sense to compare the field's value to zero before calling atomic function. Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
This commit is contained in:
@@ -1192,8 +1192,9 @@ static void _recovery_rebuild_cline_metadata(ocf_cache_t cache,
|
||||
env_atomic_inc(&core->runtime_meta->dirty_clines);
|
||||
env_atomic_inc(&core->runtime_meta->
|
||||
part_counters[part_id].dirty_clines);
|
||||
env_atomic64_cmpxchg(&core->runtime_meta->dirty_since,
|
||||
0, env_get_tick_count());
|
||||
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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user