Don't evict on hit

If request is hit, simply try to acquire cachelines instead of verifying
whether target partition's size is not exceeded.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
Michal Mielewczyk
2021-01-29 13:30:04 -05:00
parent 7f72a9431c
commit 3a7b55c4c2
2 changed files with 5 additions and 255 deletions

View File

@@ -425,61 +425,6 @@ static int lock_clines(struct ocf_request *req,
}
}
static inline int ocf_prepare_clines_hit(struct ocf_request *req,
const struct ocf_engine_callbacks *engine_cbs)
{
int lock_status = -OCF_ERR_NO_LOCK;
struct ocf_metadata_lock *metadata_lock = &req->cache->metadata.lock;
uint32_t clines_to_evict;
int res;
/* Cachelines are mapped in correct partition */
if (ocf_part_is_enabled(&req->cache->user_parts[req->part_id]) &&
!ocf_engine_needs_repart(req)) {
lock_status = lock_clines(req, engine_cbs);
ocf_req_hash_unlock_rd(req);
return lock_status;
}
res = ocf_part_check_space(req, &clines_to_evict);
if (res == OCF_PART_HAS_SPACE)
lock_status = lock_clines(req, engine_cbs);
/* Since target part is empty and disabled, request should be submited in
* pass-through */
if (res == OCF_PART_IS_DISABLED)
ocf_req_set_mapping_error(req);
ocf_req_hash_unlock_rd(req);
if (res != OCF_PART_IS_FULL)
return lock_status;
ocf_metadata_start_exclusive_access(metadata_lock);
ocf_part_check_space(req, &clines_to_evict);
if (space_managment_evict_do(req->cache, req, clines_to_evict) ==
LOOKUP_MISS) {
ocf_req_set_mapping_error(req);
goto unlock;
}
if (!ocf_part_is_enabled(&req->cache->user_parts[req->part_id])) {
/* Target part is disabled but had some cachelines assigned. Submit
* request in pass-through after eviction has been made */
ocf_req_set_mapping_error(req);
goto unlock;
}
lock_status = lock_clines(req, engine_cbs);
unlock:
ocf_metadata_end_exclusive_access(metadata_lock);
return lock_status;
}
static inline int ocf_prepare_clines_miss(struct ocf_request *req,
const struct ocf_engine_callbacks *engine_cbs)
{
@@ -571,8 +516,11 @@ int ocf_engine_prepare_clines(struct ocf_request *req,
ocf_engine_traverse(req);
mapped = ocf_engine_is_mapped(req);
if (mapped)
return ocf_prepare_clines_hit(req, engine_cbs);
if (mapped) {
lock = lock_clines(req, engine_cbs);
ocf_req_hash_unlock_rd(req);
return lock;
}
/* check if request should promote cachelines */
promote = ocf_promotion_req_should_promote(