Merge pull request #820 from mmichal10/discard-fixes

Discard fixes
This commit is contained in:
Robert Baldyga 2024-09-10 15:31:53 +02:00 committed by GitHub
commit d24e7bac5d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 3 deletions

View File

@ -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;

View File

@ -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_ */

View File

@ -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);
@ -209,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 */