From bbb0e1bbb0d929cc5157bec3c46bf16124b93c27 Mon Sep 17 00:00:00 2001 From: xqzhou Date: Fri, 1 Feb 2019 05:38:54 -0700 Subject: [PATCH] Improvement of metadata flush setting Signed-off-by: xqzhou --- src/engine/engine_common.c | 3 ++- src/utils/utils_cache_line.c | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/engine/engine_common.c b/src/engine/engine_common.c index 2e29236..934ac36 100644 --- a/src/engine/engine_common.c +++ b/src/engine/engine_common.c @@ -117,7 +117,8 @@ void ocf_engine_update_req_info(struct ocf_cache *cache, req->info.dirty_any++; /* Check if cache line is fully dirty */ - if (metadata_test_dirty_all(cache, _entry->coll_idx)) + if (metadata_test_dirty_sec(cache, _entry->coll_idx, + start_sector, end_sector)) req->info.dirty_all++; } diff --git a/src/utils/utils_cache_line.c b/src/utils/utils_cache_line.c index 50003d3..0231957 100644 --- a/src/utils/utils_cache_line.c +++ b/src/utils/utils_cache_line.c @@ -133,9 +133,9 @@ void set_cache_line_clean(struct ocf_cache *cache, uint8_t start_bit, evict_policy_ops[evp_type].clean_cline(cache, part_id, line); ocf_purge_cleaning_policy(cache, line); + ocf_metadata_flush_mark(cache, req, map_idx, CLEAN, start_bit, + end_bit); } - - ocf_metadata_flush_mark(cache, req, map_idx, CLEAN, start_bit, end_bit); } void set_cache_line_dirty(struct ocf_cache *cache, uint8_t start_bit, @@ -169,9 +169,10 @@ void set_cache_line_dirty(struct ocf_cache *cache, uint8_t start_bit, if (likely(evict_policy_ops[evp_type].dirty_cline)) evict_policy_ops[evp_type].dirty_cline(cache, part_id, line); + + ocf_metadata_flush_mark(cache, req, map_idx, DIRTY, start_bit, + end_bit); } ocf_cleaning_set_hot_cache_line(cache, line); - - ocf_metadata_flush_mark(cache, req, map_idx, DIRTY, start_bit, end_bit); }