Skip to content

Commit

Permalink
Merge pull request #820 from mmichal10/discard-fixes
Browse files Browse the repository at this point in the history
Discard fixes
  • Loading branch information
robertbaldyga authored Sep 10, 2024
2 parents 070b16b + ca7f365 commit d24e7ba
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/engine/engine_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
11 changes: 11 additions & 0 deletions src/engine/engine_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
*
Expand Down Expand Up @@ -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_ */
4 changes: 3 additions & 1 deletion src/engine/engine_discard.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit d24e7ba

Please sign in to comment.