Get rid of req->io_if

Remove one callback indirection level. I/O never changes it's direction
so there is no point in storing both read and write callbacks for each
request.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Robert Baldyga
2022-09-02 17:52:01 +02:00
parent 64167576db
commit 228c5fc891
25 changed files with 182 additions and 353 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright(c) 2012-2021 Intel Corporation
* Copyright(c) 2012-2022 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -205,11 +205,6 @@ static int _ocf_read_generic_do(struct ocf_request *req)
return 0;
}
static const struct ocf_io_if _io_if_read_generic_resume = {
.read = _ocf_read_generic_do,
.write = _ocf_read_generic_do,
};
static const struct ocf_engine_callbacks _rd_engine_callbacks =
{
.resume = ocf_engine_on_resume,
@@ -225,7 +220,7 @@ int ocf_read_generic(struct ocf_request *req)
if (env_atomic_read(&cache->pending_read_misses_list_blocked)) {
/* There are conditions to bypass IO */
req->force_pt = true;
ocf_get_io_if(ocf_cache_mode_pt)->read(req);
ocf_read_pt(req);
return 0;
}
@@ -233,7 +228,7 @@ int ocf_read_generic(struct ocf_request *req)
ocf_req_get(req);
/* Set resume call backs */
req->io_if = &_io_if_read_generic_resume;
req->engine_handler = _ocf_read_generic_do;
req->engine_cbs = &_rd_engine_callbacks;
lock = ocf_engine_prepare_clines(req);
@@ -255,7 +250,7 @@ int ocf_read_generic(struct ocf_request *req)
} else {
ocf_req_clear(req);
req->force_pt = true;
ocf_get_io_if(ocf_cache_mode_pt)->read(req);
ocf_read_pt(req);
}