Accessors for req->info.mapping_error

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
Michal Mielewczyk 2020-12-07 04:15:51 -05:00
parent 9e11a88f2e
commit 60680b15b2
6 changed files with 19 additions and 9 deletions

View File

@ -256,7 +256,7 @@ static void ocf_engine_map_cache_line(struct ocf_request *req,
ocf_cleaning_t clean_policy_type;
if (!ocf_freelist_get_cache_line(cache->freelist, cache_line)) {
req->info.mapping_error = 1;
ocf_req_set_mapping_error(req);
return;
}
@ -336,7 +336,7 @@ static void ocf_engine_map(struct ocf_request *req)
if (ocf_engine_unmapped_count(req) >
ocf_freelist_num_free(cache->freelist)) {
req->info.mapping_error = 1;
ocf_req_set_mapping_error(req);
return;
}
@ -355,7 +355,7 @@ static void ocf_engine_map(struct ocf_request *req)
ocf_engine_map_cache_line(req, entry->core_line,
entry->hash, &entry->coll_idx);
if (req->info.mapping_error) {
if (ocf_req_test_mapping_error(req)) {
/*
* Eviction error (mapping error), need to
* clean, return and do pass through
@ -377,7 +377,7 @@ static void ocf_engine_map(struct ocf_request *req)
}
if (!req->info.mapping_error) {
if (!ocf_req_test_mapping_error(req)) {
/* request has been inserted into cache - purge it from promotion
* policy */
ocf_promotion_req_purge(cache->promotion_policy, req);
@ -578,7 +578,7 @@ int ocf_engine_prepare_clines(struct ocf_request *req,
promote = ocf_promotion_req_should_promote(
req->cache->promotion_policy, req);
if (!promote) {
req->info.mapping_error = 1;
ocf_req_set_mapping_error(req);
ocf_req_hash_unlock_rd(req);
return lock;
}

View File

@ -243,7 +243,7 @@ int ocf_read_generic(struct ocf_request *req)
lock = ocf_engine_prepare_clines(req, &_rd_engine_callbacks);
if (!req->info.mapping_error) {
if (!ocf_req_test_mapping_error(req)) {
if (lock >= 0) {
if (lock != OCF_LOCK_ACQUIRED) {
/* Lock was not acquired, need to wait for resume */

View File

@ -189,7 +189,7 @@ int ocf_write_wb(struct ocf_request *req)
lock = ocf_engine_prepare_clines(req, &_wb_engine_callbacks);
if (!req->info.mapping_error) {
if (!ocf_req_test_mapping_error(req)) {
if (lock >= 0) {
if (lock != OCF_LOCK_ACQUIRED) {
/* WR lock was not acquired, need to wait for resume */

View File

@ -183,7 +183,7 @@ int ocf_write_wt(struct ocf_request *req)
lock = ocf_engine_prepare_clines(req, &_wt_engine_callbacks);
if (!req->info.mapping_error) {
if (!ocf_req_test_mapping_error(req)) {
if (lock >= 0) {
if (lock != OCF_LOCK_ACQUIRED) {
/* WR lock was not acquired, need to wait for resume */

View File

@ -125,6 +125,6 @@ int space_managment_evict_do(struct ocf_cache *cache,
if (evict_cline_no <= evicted)
return LOOKUP_MAPPED;
req->info.mapping_error |= true;
ocf_req_set_mapping_error(req);
return LOOKUP_MISS;
}

View File

@ -381,6 +381,16 @@ static inline void ocf_req_clear(struct ocf_request *req)
env_atomic_set(&req->req_remaining, 0);
}
static inline void ocf_req_set_mapping_error(struct ocf_request *req)
{
req->info.mapping_error = true;
}
static inline bool ocf_req_test_mapping_error(struct ocf_request *req)
{
return req->info.mapping_error;
}
/**
* @brief Return OCF request reference count
*