Do not repartition cachelines in WO read

WO cache mode should not repartition cachelines nor affect cacheline
status in any way when servicing read. Reading data from the cache
is just an internal optimization. Also WO cache mode is designed to
be used with partitioning based on write life-time hints and read
requests do not carry write lifetime hint by definition.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
Adam Rutkowski 2019-06-12 18:50:34 -04:00
parent 9dc1381b77
commit 6bb1d21489
3 changed files with 21 additions and 29 deletions

View File

@ -101,7 +101,7 @@ static void _ocf_read_generic_miss_complete(struct ocf_request *req, int error)
} }
} }
static inline void _ocf_read_generic_submit_hit(struct ocf_request *req) void ocf_read_generic_submit_hit(struct ocf_request *req)
{ {
env_atomic_set(&req->req_remaining, ocf_engine_io_count(req)); env_atomic_set(&req->req_remaining, ocf_engine_io_count(req));
@ -135,7 +135,7 @@ err_alloc:
_ocf_read_generic_miss_complete(req, -OCF_ERR_NO_MEM); _ocf_read_generic_miss_complete(req, -OCF_ERR_NO_MEM);
} }
int ocf_read_generic_do(struct ocf_request *req) static int _ocf_read_generic_do(struct ocf_request *req)
{ {
struct ocf_cache *cache = req->cache; struct ocf_cache *cache = req->cache;
@ -191,7 +191,7 @@ int ocf_read_generic_do(struct ocf_request *req)
/* Submit IO */ /* Submit IO */
if (ocf_engine_is_hit(req)) if (ocf_engine_is_hit(req))
_ocf_read_generic_submit_hit(req); ocf_read_generic_submit_hit(req);
else else
_ocf_read_generic_submit_miss(req); _ocf_read_generic_submit_miss(req);
@ -206,8 +206,8 @@ int ocf_read_generic_do(struct ocf_request *req)
} }
static const struct ocf_io_if _io_if_read_generic_resume = { static const struct ocf_io_if _io_if_read_generic_resume = {
.read = ocf_read_generic_do, .read = _ocf_read_generic_do,
.write = ocf_read_generic_do, .write = _ocf_read_generic_do,
.resume = ocf_engine_on_resume, .resume = ocf_engine_on_resume,
}; };
@ -294,7 +294,7 @@ int ocf_read_generic(struct ocf_request *req)
OCF_DEBUG_RQ(req, "NO LOCK"); OCF_DEBUG_RQ(req, "NO LOCK");
} else { } else {
/* Lock was acquired can perform IO */ /* Lock was acquired can perform IO */
ocf_read_generic_do(req); _ocf_read_generic_do(req);
} }
} else { } else {
OCF_DEBUG_RQ(req, "LOCK ERROR %d", lock); OCF_DEBUG_RQ(req, "LOCK ERROR %d", lock);

View File

@ -8,6 +8,6 @@
int ocf_read_generic(struct ocf_request *req); int ocf_read_generic(struct ocf_request *req);
int ocf_read_generic_do(struct ocf_request *req); void ocf_read_generic_submit_hit(struct ocf_request *req);
#endif /* ENGINE_RD_H_ */ #endif /* ENGINE_RD_H_ */

View File

@ -167,38 +167,30 @@ static void _ocf_read_wo_core_complete(struct ocf_request *req, int error)
int ocf_read_wo_do(struct ocf_request *req) int ocf_read_wo_do(struct ocf_request *req)
{ {
ocf_cache_t cache = req->cache;
if (ocf_engine_is_hit(req)) {
/* read hit - just fetch the data from cache using standard read path
*/
ocf_read_generic_do(req);
return 0;
}
ocf_req_get(req); ocf_req_get(req);
if (req->info.re_part) { /* Lack of cacheline repartitioning here is deliberate. WO cache mode
OCF_DEBUG_RQ(req, "Re-Part"); * reads should not affect cacheline status as reading data from the
* cache is just an internal optimization. Also WO cache mode is
* designed to be used with partitioning based on write life-time hints
* and read requests do not carry write lifetime hint by definition.
*/
OCF_METADATA_LOCK_WR(); if (ocf_engine_is_hit(req)) {
/* read hit - just fetch the data from cache */
OCF_DEBUG_RQ(req, "Submit cache hit");
ocf_read_generic_submit_hit(req);
} else {
/* Probably some cache lines are assigned into wrong OCF_DEBUG_RQ(req, "Submit core");
* partition. Need to move it to new one ocf_submit_volume_req(&req->core->volume, req,
*/ _ocf_read_wo_core_complete);
ocf_part_move(req);
OCF_METADATA_UNLOCK_WR();
} }
OCF_DEBUG_RQ(req, "Submit core");
ocf_submit_volume_req(&req->core->volume, req, _ocf_read_wo_core_complete);
ocf_engine_update_request_stats(req); ocf_engine_update_request_stats(req);
ocf_engine_update_block_stats(req); ocf_engine_update_block_stats(req);
ocf_req_put(req); ocf_req_put(req);
return 0; return 0;
} }