From 7dfe70f69b7ca40c03231a01a9ccfbf38926b858 Mon Sep 17 00:00:00 2001 From: Rafal Stefanowski Date: Thu, 1 Feb 2024 16:56:56 +0100 Subject: [PATCH 1/3] Fix discard step callback refcount Signed-off-by: Rafal Stefanowski Signed-off-by: Michal Mielewczyk --- src/engine/engine_discard.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/engine/engine_discard.c b/src/engine/engine_discard.c index b5e975b0..9b7c01b9 100644 --- a/src/engine/engine_discard.c +++ b/src/engine/engine_discard.c @@ -156,6 +156,8 @@ static int _ocf_discard_step_do(struct ocf_request *req) ocf_hb_req_prot_unlock_wr(req); if (req->info.flush_metadata) { + env_atomic_inc(&req->req_remaining); + /* Request was dirty and need to flush metadata */ ocf_metadata_flush_do_asynch(cache, req, _ocf_discard_step_complete); From 0df0eec7f0df3a5698c49c0e52e648be4137c848 Mon Sep 17 00:00:00 2001 From: Michal Mielewczyk Date: Wed, 14 Aug 2024 07:25:00 +0200 Subject: [PATCH 2/3] Uncouple lookup() and set_hot() Signed-off-by: Michal Mielewczyk --- src/engine/engine_common.c | 4 ++-- src/engine/engine_common.h | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/engine/engine_common.c b/src/engine/engine_common.c index c974833e..c12bd0dc 100644 --- a/src/engine/engine_common.c +++ b/src/engine/engine_common.c @@ -185,7 +185,7 @@ static void ocf_engine_update_req_info(struct ocf_cache *cache, req->info.seq_no++; } -static void ocf_engine_set_hot(struct ocf_request *req) +void ocf_engine_set_hot(struct ocf_request *req) { struct ocf_cache *cache = req->cache; struct ocf_map_info *entry; @@ -208,7 +208,7 @@ static void ocf_engine_set_hot(struct ocf_request *req) } } -static void ocf_engine_lookup(struct ocf_request *req) +void ocf_engine_lookup(struct ocf_request *req) { uint32_t i; uint64_t core_line; diff --git a/src/engine/engine_common.h b/src/engine/engine_common.h index 6c6946ee..4474a220 100644 --- a/src/engine/engine_common.h +++ b/src/engine/engine_common.h @@ -234,6 +234,15 @@ struct ocf_engine_callbacks */ int ocf_engine_prepare_clines(struct ocf_request *req); +/** +* @brief Check if the OCF request is mapped to cache (lookup cache) +* +* @note This function checks if there is a HIT without updating hotness info +* +* @param req OCF request +*/ +void ocf_engine_lookup(struct ocf_request *req); + /** * @brief Traverse OCF request (lookup cache) * @@ -285,4 +294,6 @@ void inc_fallback_pt_error_counter(ocf_cache_t cache); void ocf_engine_on_resume(struct ocf_request *req); +void ocf_engine_set_hot(struct ocf_request *req); + #endif /* ENGINE_COMMON_H_ */ From ca7f3651e9d4a162bb3f0086042d2433028cafe0 Mon Sep 17 00:00:00 2001 From: Michal Mielewczyk Date: Mon, 26 Aug 2024 13:18:23 +0200 Subject: [PATCH 3/3] discard engine: lookup without updating hotness Signed-off-by: Michal Mielewczyk --- src/engine/engine_discard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/engine_discard.c b/src/engine/engine_discard.c index 9b7c01b9..bcef8c5d 100644 --- a/src/engine/engine_discard.c +++ b/src/engine/engine_discard.c @@ -211,7 +211,7 @@ static int _ocf_discard_step(struct ocf_request *req) ocf_hb_req_prot_lock_rd(req); /* Travers to check if request is mapped fully */ - ocf_engine_traverse(req); + ocf_engine_lookup(req); if (ocf_engine_mapped_count(req)) { /* Some cache line are mapped, lock request for WRITE access */