Move resume callback to async lock function params (refactoring)
This is a step towards common async lock interface in OCF. Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
@@ -208,7 +208,6 @@ static int _ocf_read_generic_do(struct ocf_request *req)
|
||||
static const struct ocf_io_if _io_if_read_generic_resume = {
|
||||
.read = _ocf_read_generic_do,
|
||||
.write = _ocf_read_generic_do,
|
||||
.resume = ocf_engine_on_resume,
|
||||
};
|
||||
|
||||
int ocf_read_generic(struct ocf_request *req)
|
||||
@@ -243,13 +242,13 @@ int ocf_read_generic(struct ocf_request *req)
|
||||
/* Request is fully mapped, no need to call eviction */
|
||||
if (ocf_engine_is_hit(req)) {
|
||||
/* There is a hit, lock request for READ access */
|
||||
lock = ocf_req_trylock_rd(req);
|
||||
lock = ocf_req_async_lock_rd(req, ocf_engine_on_resume);
|
||||
} else {
|
||||
/* All cache line mapped, but some sectors are not valid
|
||||
* and cache insert will be performed - lock for
|
||||
* WRITE is required
|
||||
*/
|
||||
lock = ocf_req_trylock_wr(req);
|
||||
lock = ocf_req_async_lock_wr(req, ocf_engine_on_resume);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,12 +273,14 @@ int ocf_read_generic(struct ocf_request *req)
|
||||
/* After mapping turns out there is hit,
|
||||
* so lock OCF request for read access
|
||||
*/
|
||||
lock = ocf_req_trylock_rd(req);
|
||||
lock = ocf_req_async_lock_rd(req,
|
||||
ocf_engine_on_resume);
|
||||
} else {
|
||||
/* Miss, new cache lines were mapped,
|
||||
* need to lock OCF request for write access
|
||||
*/
|
||||
lock = ocf_req_trylock_wr(req);
|
||||
lock = ocf_req_async_lock_wr(req,
|
||||
ocf_engine_on_resume);
|
||||
}
|
||||
}
|
||||
OCF_METADATA_UNLOCK_WR();
|
||||
|
Reference in New Issue
Block a user