From 228c5fc89170bc81b7ce811e76fb935e52264997 Mon Sep 17 00:00:00 2001 From: Robert Baldyga Date: Fri, 2 Sep 2022 17:52:01 +0200 Subject: [PATCH] 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 --- src/engine/cache_engine.c | 131 +++++++++++++++---------- src/engine/cache_engine.h | 17 +--- src/engine/engine_bf.c | 9 +- src/engine/engine_common.c | 29 ++---- src/engine/engine_common.h | 8 +- src/engine/engine_discard.c | 39 ++------ src/engine/engine_fast.c | 20 +--- src/engine/engine_inv.c | 9 +- src/engine/engine_pt.c | 16 ++- src/engine/engine_rd.c | 13 +-- src/engine/engine_wa.c | 8 +- src/engine/engine_wb.c | 23 ++--- src/engine/engine_wi.c | 35 ++----- src/engine/engine_wo.c | 14 +-- src/engine/engine_wt.c | 22 ++--- src/engine/engine_zero.c | 18 +--- src/metadata/metadata_io.c | 23 +---- src/metadata/metadata_passive_update.c | 9 +- src/metadata/metadata_raw_dynamic.c | 18 +--- src/mngt/ocf_mngt_flush.c | 9 +- src/ocf_queue.c | 7 +- src/ocf_request.h | 6 +- src/utils/utils_cleaner.c | 35 +------ src/utils/utils_parallelize.c | 10 +- src/utils/utils_pipeline.c | 7 +- 25 files changed, 182 insertions(+), 353 deletions(-) diff --git a/src/engine/cache_engine.c b/src/engine/cache_engine.c index fdfa7af..3cf318b 100644 --- a/src/engine/cache_engine.c +++ b/src/engine/cache_engine.c @@ -1,5 +1,5 @@ /* - * Copyright(c) 2012-2021 Intel Corporation + * Copyright(c) 2012-2022 Intel Corporation * SPDX-License-Identifier: BSD-3-Clause */ @@ -47,53 +47,73 @@ enum ocf_io_if_type { static const struct ocf_io_if IO_IFS[OCF_IO_PRIV_MAX_IF] = { [OCF_IO_WT_IF] = { - .read = ocf_read_generic, - .write = ocf_write_wt, + .cbs = { + [OCF_READ] = ocf_read_generic, + [OCF_WRITE] = ocf_write_wt, + }, .name = "Write Through" }, [OCF_IO_WB_IF] = { - .read = ocf_read_generic, - .write = ocf_write_wb, + .cbs = { + [OCF_READ] = ocf_read_generic, + [OCF_WRITE] = ocf_write_wb, + }, .name = "Write Back" }, [OCF_IO_WA_IF] = { - .read = ocf_read_generic, - .write = ocf_write_wa, + .cbs = { + [OCF_READ] = ocf_read_generic, + [OCF_WRITE] = ocf_write_wa, + }, .name = "Write Around" }, [OCF_IO_WI_IF] = { - .read = ocf_read_generic, - .write = ocf_write_wi, + .cbs = { + [OCF_READ] = ocf_read_generic, + [OCF_WRITE] = ocf_write_wi, + }, .name = "Write Invalidate" }, [OCF_IO_PT_IF] = { - .read = ocf_read_pt, - .write = ocf_write_wi, + .cbs = { + [OCF_READ] = ocf_read_pt, + [OCF_WRITE] = ocf_write_wi, + }, .name = "Pass Through", }, [OCF_IO_WO_IF] = { - .read = ocf_read_wo, - .write = ocf_write_wb, + .cbs = { + [OCF_READ] = ocf_read_wo, + [OCF_WRITE] = ocf_write_wb, + }, .name = "Write Only", }, [OCF_IO_FAST_IF] = { - .read = ocf_read_fast, - .write = ocf_write_fast, + .cbs = { + [OCF_READ] = ocf_read_fast, + [OCF_WRITE] = ocf_write_fast, + }, .name = "Fast", }, [OCF_IO_DISCARD_IF] = { - .read = ocf_discard, - .write = ocf_discard, + .cbs = { + [OCF_READ] = ocf_discard, + [OCF_WRITE] = ocf_discard, + }, .name = "Discard", }, [OCF_IO_D2C_IF] = { - .read = ocf_io_d2c, - .write = ocf_io_d2c, + .cbs = { + [OCF_READ] = ocf_io_d2c, + [OCF_WRITE] = ocf_io_d2c, + }, .name = "Direct to core", }, [OCF_IO_OPS_IF] = { - .read = ocf_engine_ops, - .write = ocf_engine_ops, + .cbs = { + [OCF_READ] = ocf_engine_ops, + [OCF_WRITE] = ocf_engine_ops, + }, .name = "Ops engine", }, }; @@ -109,11 +129,32 @@ static const struct ocf_io_if *cache_mode_io_if_map[ocf_req_cache_mode_max] = { [ocf_req_cache_mode_d2c] = &IO_IFS[OCF_IO_D2C_IF], }; -const struct ocf_io_if *ocf_get_io_if(ocf_req_cache_mode_t req_cache_mode) +const char *ocf_get_io_iface_name(ocf_req_cache_mode_t cache_mode) +{ + if (cache_mode == ocf_req_cache_mode_max) + return "Unknown"; + + return cache_mode_io_if_map[cache_mode]->name; +} + +static ocf_engine_cb ocf_io_if_type_to_engine_cb( + enum ocf_io_if_type io_if_type, int rw) +{ + if (unlikely(io_if_type == OCF_IO_MAX_IF || + io_if_type == OCF_IO_PRIV_MAX_IF)) { + return NULL; + } + + return IO_IFS[io_if_type].cbs[rw]; +} + +static ocf_engine_cb ocf_cache_mode_to_engine_cb( + ocf_req_cache_mode_t req_cache_mode, int rw) { if (req_cache_mode == ocf_req_cache_mode_max) return NULL; - return cache_mode_io_if_map[req_cache_mode]; + + return cache_mode_io_if_map[req_cache_mode]->cbs[rw]; } struct ocf_request *ocf_engine_pop_req(ocf_queue_t q) @@ -205,8 +246,10 @@ int ocf_engine_hndl_req(struct ocf_request *req) OCF_CHECK_NULL(cache); - req->io_if = ocf_get_io_if(req->cache_mode); - if (!req->io_if) + req->engine_handler = ocf_cache_mode_to_engine_cb(req->cache_mode, + req->rw); + + if (!req->engine_handler) return -OCF_ERR_INVAL; ocf_req_get(req); @@ -222,25 +265,16 @@ int ocf_engine_hndl_req(struct ocf_request *req) int ocf_engine_hndl_fast_req(struct ocf_request *req) { - const struct ocf_io_if *io_if; + ocf_engine_cb engine_cb; int ret; - io_if = ocf_get_io_if(req->cache_mode); - if (!io_if) + engine_cb = ocf_cache_mode_to_engine_cb(req->cache_mode, req->rw); + if (!engine_cb) return -OCF_ERR_INVAL; ocf_req_get(req); - switch (req->rw) { - case OCF_READ: - ret = io_if->read(req); - break; - case OCF_WRITE: - ret = io_if->write(req); - break; - default: - ret = OCF_FAST_PATH_NO; - } + ret = engine_cb(req); if (ret == OCF_FAST_PATH_NO) ocf_req_put(req); @@ -250,12 +284,7 @@ int ocf_engine_hndl_fast_req(struct ocf_request *req) static void ocf_engine_hndl_2dc_req(struct ocf_request *req) { - if (OCF_READ == req->rw) - IO_IFS[OCF_IO_D2C_IF].read(req); - else if (OCF_WRITE == req->rw) - IO_IFS[OCF_IO_D2C_IF].write(req); - else - ENV_BUG(); + IO_IFS[OCF_IO_D2C_IF].cbs[req->rw](req); } void ocf_engine_hndl_discard_req(struct ocf_request *req) @@ -267,22 +296,16 @@ void ocf_engine_hndl_discard_req(struct ocf_request *req) return; } - if (OCF_READ == req->rw) - IO_IFS[OCF_IO_DISCARD_IF].read(req); - else if (OCF_WRITE == req->rw) - IO_IFS[OCF_IO_DISCARD_IF].write(req); - else - ENV_BUG(); + IO_IFS[OCF_IO_DISCARD_IF].cbs[req->rw](req); } void ocf_engine_hndl_ops_req(struct ocf_request *req) { ocf_req_get(req); - if (req->d2c) - req->io_if = &IO_IFS[OCF_IO_D2C_IF]; - else - req->io_if = &IO_IFS[OCF_IO_OPS_IF]; + req->engine_handler = (req->d2c) ? + ocf_io_if_type_to_engine_cb(OCF_IO_D2C_IF, req->rw) : + ocf_io_if_type_to_engine_cb(OCF_IO_OPS_IF, req->rw); ocf_engine_push_req_back(req, true); } diff --git a/src/engine/cache_engine.h b/src/engine/cache_engine.h index 40d5c96..61065fe 100644 --- a/src/engine/cache_engine.h +++ b/src/engine/cache_engine.h @@ -1,5 +1,5 @@ /* - * Copyright(c) 2012-2021 Intel Corporation + * Copyright(c) 2012-2022 Intel Corporation * SPDX-License-Identifier: BSD-3-Clause */ @@ -32,10 +32,10 @@ typedef enum { ocf_req_cache_mode_max, } ocf_req_cache_mode_t; -struct ocf_io_if { - int (*read)(struct ocf_request *req); +typedef int (*ocf_engine_cb)(struct ocf_request *req); - int (*write)(struct ocf_request *req); +struct ocf_io_if { + ocf_engine_cb cbs[2]; /* READ and WRITE */ const char *name; }; @@ -43,14 +43,7 @@ struct ocf_io_if { void ocf_resolve_effective_cache_mode(ocf_cache_t cache, ocf_core_t core, struct ocf_request *req); -const struct ocf_io_if *ocf_get_io_if(ocf_req_cache_mode_t cache_mode); - -static inline const char *ocf_get_io_iface_name(ocf_cache_mode_t cache_mode) -{ - const struct ocf_io_if *iface = ocf_get_io_if(cache_mode); - - return iface ? iface->name : "Unknown"; -} +const char *ocf_get_io_iface_name(ocf_req_cache_mode_t cache_mode); bool ocf_req_cache_mode_has_lazy_write(ocf_req_cache_mode_t mode); diff --git a/src/engine/engine_bf.c b/src/engine/engine_bf.c index 43351c1..d33116d 100644 --- a/src/engine/engine_bf.c +++ b/src/engine/engine_bf.c @@ -1,5 +1,5 @@ /* - * Copyright(c) 2012-2021 Intel Corporation + * Copyright(c) 2012-2022 Intel Corporation * SPDX-License-Identifier: BSD-3-Clause */ @@ -90,13 +90,8 @@ static int _ocf_backfill_do(struct ocf_request *req) return 0; } -static const struct ocf_io_if _io_if_backfill = { - .read = _ocf_backfill_do, - .write = _ocf_backfill_do, -}; - void ocf_engine_backfill(struct ocf_request *req) { backfill_queue_inc_block(req->cache); - ocf_engine_push_req_front_if(req, &_io_if_backfill, true); + ocf_engine_push_req_front_cb(req, _ocf_backfill_do, true); } diff --git a/src/engine/engine_common.c b/src/engine/engine_common.c index 74b18b5..b54c865 100644 --- a/src/engine/engine_common.c +++ b/src/engine/engine_common.c @@ -644,12 +644,12 @@ void ocf_engine_push_req_front(struct ocf_request *req, bool allow_sync) ocf_queue_kick(q, allow_sync); } -void ocf_engine_push_req_front_if(struct ocf_request *req, - const struct ocf_io_if *io_if, +void ocf_engine_push_req_front_cb(struct ocf_request *req, + ocf_engine_cb engine_cb, bool allow_sync) { req->error = 0; /* Please explain why!!! */ - req->io_if = io_if; + req->engine_handler = engine_cb; ocf_engine_push_req_front(req, allow_sync); } @@ -681,16 +681,10 @@ static int _ocf_engine_refresh(struct ocf_request *req) if (result == 0) { /* Refresh successful, can process with original IO interface */ - req->io_if = req->priv; - + req->engine_handler = req->priv; req->priv = NULL; - if (req->rw == OCF_READ) - req->io_if->read(req); - else if (req->rw == OCF_WRITE) - req->io_if->write(req); - else - ENV_BUG(); + req->engine_handler(req); } else { ENV_WARN(true, "Inconsistent request"); req->error = -OCF_ERR_INVAL; @@ -708,20 +702,15 @@ static int _ocf_engine_refresh(struct ocf_request *req) return 0; } -static const struct ocf_io_if _io_if_refresh = { - .read = _ocf_engine_refresh, - .write = _ocf_engine_refresh, -}; - void ocf_engine_on_resume(struct ocf_request *req) { ENV_BUG_ON(req->priv); - OCF_CHECK_NULL(req->io_if); + OCF_CHECK_NULL(req->engine_handler); - /* Exchange IO interface */ - req->priv = (void *)req->io_if; + /* Exchange engine handler */ + req->priv = (void *)req->engine_handler; OCF_DEBUG_RQ(req, "On resume"); - ocf_engine_push_req_front_if(req, &_io_if_refresh, false); + ocf_engine_push_req_front_cb(req, _ocf_engine_refresh, false); } diff --git a/src/engine/engine_common.h b/src/engine/engine_common.h index fbff231..6f9c73f 100644 --- a/src/engine/engine_common.h +++ b/src/engine/engine_common.h @@ -1,5 +1,5 @@ /* - * Copyright(c) 2012-2021 Intel Corporation + * Copyright(c) 2012-2022 Intel Corporation * SPDX-License-Identifier: BSD-3-Clause */ @@ -304,12 +304,12 @@ void ocf_engine_push_req_front(struct ocf_request *req, * @brief Set interface and push from request to the OCF thread worker queue * * @param req OCF request - * @param io_if IO interface + * @param engine_cb IO engine handler callback * @param allow_sync caller allows for request from queue to be ran immediately from push function in caller context */ -void ocf_engine_push_req_front_if(struct ocf_request *req, - const struct ocf_io_if *io_if, +void ocf_engine_push_req_front_cb(struct ocf_request *req, + ocf_engine_cb engine_cb, bool allow_sync); void inc_fallback_pt_error_counter(ocf_cache_t cache); diff --git a/src/engine/engine_discard.c b/src/engine/engine_discard.c index 0966aa1..3860386 100644 --- a/src/engine/engine_discard.c +++ b/src/engine/engine_discard.c @@ -1,5 +1,5 @@ /* - * Copyright(c) 2012-2021 Intel Corporation + * Copyright(c) 2012-2022 Intel Corporation * SPDX-License-Identifier: BSD-3-Clause */ #include "ocf/ocf.h" @@ -18,31 +18,6 @@ #define OCF_ENGINE_DEBUG_IO_NAME "discard" #include "engine_debug.h" -static int _ocf_discard_step_do(struct ocf_request *req); -static int _ocf_discard_step(struct ocf_request *req); -static int _ocf_discard_flush_cache(struct ocf_request *req); -static int _ocf_discard_core(struct ocf_request *req); - -static const struct ocf_io_if _io_if_discard_step = { - .read = _ocf_discard_step, - .write = _ocf_discard_step, -}; - -static const struct ocf_io_if _io_if_discard_step_resume = { - .read = _ocf_discard_step_do, - .write = _ocf_discard_step_do, -}; - -static const struct ocf_io_if _io_if_discard_flush_cache = { - .read = _ocf_discard_flush_cache, - .write = _ocf_discard_flush_cache, -}; - -static const struct ocf_io_if _io_if_discard_core = { - .read = _ocf_discard_core, - .write = _ocf_discard_core, -}; - static void _ocf_discard_complete_req(struct ocf_request *req, int error) { req->complete(req, error); @@ -97,7 +72,7 @@ static void _ocf_discard_cache_flush_complete(struct ocf_io *io, int error) return; } - req->io_if = &_io_if_discard_core; + req->engine_handler = _ocf_discard_core; ocf_engine_push_req_front(req, true); ocf_io_put(io); @@ -122,16 +97,18 @@ static int _ocf_discard_flush_cache(struct ocf_request *req) return 0; } +static int _ocf_discard_step(struct ocf_request *req); + static void _ocf_discard_finish_step(struct ocf_request *req) { req->discard.handled += BYTES_TO_SECTORS(req->byte_length); if (req->discard.handled < req->discard.nr_sects) - req->io_if = &_io_if_discard_step; + req->engine_handler = _ocf_discard_step; else if (!req->cache->metadata.is_volatile) - req->io_if = &_io_if_discard_flush_cache; + req->engine_handler = _ocf_discard_flush_cache; else - req->io_if = &_io_if_discard_core; + req->engine_handler = _ocf_discard_core; ocf_engine_push_req_front(req, true); } @@ -222,7 +199,7 @@ static int _ocf_discard_step(struct ocf_request *req) req->core_line_last = ocf_bytes_2_lines(cache, req->byte_position + req->byte_length - 1); req->core_line_count = req->core_line_last - req->core_line_first + 1; - req->io_if = &_io_if_discard_step_resume; + req->engine_handler = _ocf_discard_step_do; ENV_BUG_ON(env_memset(req->map, sizeof(*req->map) * req->core_line_count, 0)); diff --git a/src/engine/engine_fast.c b/src/engine/engine_fast.c index f878f07..a9b04d5 100644 --- a/src/engine/engine_fast.c +++ b/src/engine/engine_fast.c @@ -1,5 +1,5 @@ /* - * Copyright(c) 2012-2021 Intel Corporation + * Copyright(c) 2012-2022 Intel Corporation * SPDX-License-Identifier: BSD-3-Clause */ @@ -99,11 +99,6 @@ static int _ocf_read_fast_do(struct ocf_request *req) return 0; } -static const struct ocf_io_if _io_if_read_fast_resume = { - .read = _ocf_read_fast_do, - .write = _ocf_read_fast_do, -}; - int ocf_read_fast(struct ocf_request *req) { bool hit; @@ -113,8 +108,8 @@ int ocf_read_fast(struct ocf_request *req) /* Get OCF request - increase reference counter */ ocf_req_get(req); - /* Set resume io_if */ - req->io_if = &_io_if_read_fast_resume; + /* Set resume handler */ + req->engine_handler = _ocf_read_fast_do; /*- Metadata RD access -----------------------------------------------*/ @@ -171,11 +166,6 @@ int ocf_read_fast(struct ocf_request *req) * \/ \/ |_| |_|\__\___| |_| \__,_|___/\__| |_| \__,_|\__|_| |_| */ -static const struct ocf_io_if _io_if_write_fast_resume = { - .read = ocf_write_wb_do, - .write = ocf_write_wb_do, -}; - int ocf_write_fast(struct ocf_request *req) { bool mapped; @@ -185,8 +175,8 @@ int ocf_write_fast(struct ocf_request *req) /* Get OCF request - increase reference counter */ ocf_req_get(req); - /* Set resume io_if */ - req->io_if = &_io_if_write_fast_resume; + /* Set resume handler */ + req->engine_handler = ocf_write_wb_do; /*- Metadata RD access -----------------------------------------------*/ diff --git a/src/engine/engine_inv.c b/src/engine/engine_inv.c index 608f951..4b60b2b 100644 --- a/src/engine/engine_inv.c +++ b/src/engine/engine_inv.c @@ -1,5 +1,5 @@ /* - * Copyright(c) 2012-2021 Intel Corporation + * Copyright(c) 2012-2022 Intel Corporation * SPDX-License-Identifier: BSD-3-Clause */ @@ -60,12 +60,7 @@ static int _ocf_invalidate_do(struct ocf_request *req) return 0; } -static const struct ocf_io_if _io_if_invalidate = { - .read = _ocf_invalidate_do, - .write = _ocf_invalidate_do, -}; - void ocf_engine_invalidate(struct ocf_request *req) { - ocf_engine_push_req_front_if(req, &_io_if_invalidate, true); + ocf_engine_push_req_front_cb(req, _ocf_invalidate_do, true); } diff --git a/src/engine/engine_pt.c b/src/engine/engine_pt.c index 374eda6..8c5706d 100644 --- a/src/engine/engine_pt.c +++ b/src/engine/engine_pt.c @@ -1,10 +1,11 @@ /* - * Copyright(c) 2012-2021 Intel Corporation + * Copyright(c) 2012-2022 Intel Corporation * SPDX-License-Identifier: BSD-3-Clause */ #include "ocf/ocf.h" #include "../ocf_cache_priv.h" #include "engine_pt.h" +#include "engine_rd.h" #include "engine_common.h" #include "cache_engine.h" #include "../ocf_request.h" @@ -94,11 +95,6 @@ int ocf_read_pt_do(struct ocf_request *req) return 0; } -static const struct ocf_io_if _io_if_pt_resume = { - .read = ocf_read_pt_do, - .write = ocf_read_pt_do, -}; - int ocf_read_pt(struct ocf_request *req) { bool use_cache = false; @@ -111,8 +107,8 @@ int ocf_read_pt(struct ocf_request *req) /* Get OCF request - increase reference counter */ ocf_req_get(req); - /* Set resume io_if */ - req->io_if = &_io_if_pt_resume; + /* Set resume handler */ + req->engine_handler = ocf_read_pt_do; ocf_req_hash(req); ocf_hb_req_prot_lock_rd(req); @@ -146,7 +142,7 @@ int ocf_read_pt(struct ocf_request *req) * because of this force read data from cache */ ocf_req_clear(req); - ocf_get_io_if(ocf_cache_mode_wt)->read(req); + ocf_read_generic(req); } else { if (lock >= 0) { if (lock == OCF_LOCK_ACQUIRED) { @@ -171,6 +167,6 @@ int ocf_read_pt(struct ocf_request *req) void ocf_engine_push_req_front_pt(struct ocf_request *req) { - ocf_engine_push_req_front_if(req, &_io_if_pt_resume, true); + ocf_engine_push_req_front_cb(req, ocf_read_pt_do, true); } diff --git a/src/engine/engine_rd.c b/src/engine/engine_rd.c index 19b747b..8ccbcfc 100644 --- a/src/engine/engine_rd.c +++ b/src/engine/engine_rd.c @@ -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); } diff --git a/src/engine/engine_wa.c b/src/engine/engine_wa.c index 2a716df..2e68a0b 100644 --- a/src/engine/engine_wa.c +++ b/src/engine/engine_wa.c @@ -1,10 +1,12 @@ /* - * Copyright(c) 2012-2021 Intel Corporation + * Copyright(c) 2012-2022 Intel Corporation * SPDX-License-Identifier: BSD-3-Clause */ #include "ocf/ocf.h" #include "../ocf_cache_priv.h" #include "engine_wa.h" +#include "engine_wt.h" +#include "engine_wi.h" #include "engine_common.h" #include "cache_engine.h" #include "../ocf_request.h" @@ -34,13 +36,13 @@ int ocf_write_wa(struct ocf_request *req) ocf_req_clear(req); /* There is HIT, do WT */ - ocf_get_io_if(ocf_cache_mode_wt)->write(req); + ocf_write_wt(req); } else { ocf_req_clear(req); /* MISS, do WI */ - ocf_get_io_if(ocf_cache_mode_wi)->write(req); + ocf_write_wi(req); } /* Put OCF request - decrease reference counter */ diff --git a/src/engine/engine_wb.c b/src/engine/engine_wb.c index d5d8d4b..15574ae 100644 --- a/src/engine/engine_wb.c +++ b/src/engine/engine_wb.c @@ -1,5 +1,5 @@ /* - * Copyright(c) 2012-2021 Intel Corporation + * Copyright(c) 2012-2022 Intel Corporation * SPDX-License-Identifier: BSD-3-Clause */ @@ -8,6 +8,7 @@ #include "cache_engine.h" #include "engine_common.h" #include "engine_wb.h" +#include "engine_wi.h" #include "engine_inv.h" #include "../metadata/metadata.h" #include "../ocf_request.h" @@ -20,11 +21,6 @@ #define OCF_ENGINE_DEBUG_IO_NAME "wb" #include "engine_debug.h" -static const struct ocf_io_if _io_if_wb_resume = { - .read = ocf_write_wb_do, - .write = ocf_write_wb_do, -}; - static void _ocf_write_wb_update_bits(struct ocf_request *req) { bool miss = ocf_engine_is_miss(req); @@ -87,11 +83,6 @@ static int ocf_write_wb_do_flush_metadata(struct ocf_request *req) return 0; } -static const struct ocf_io_if _io_if_wb_flush_metadata = { - .read = ocf_write_wb_do_flush_metadata, - .write = ocf_write_wb_do_flush_metadata, -}; - static void _ocf_write_wb_complete(struct ocf_request *req, int error) { if (error) { @@ -111,8 +102,8 @@ static void _ocf_write_wb_complete(struct ocf_request *req, int error) ocf_engine_invalidate(req); } else { - ocf_engine_push_req_front_if(req, &_io_if_wb_flush_metadata, - true); + ocf_engine_push_req_front_cb(req, + ocf_write_wb_do_flush_metadata, true); } } @@ -181,8 +172,8 @@ int ocf_write_wb(struct ocf_request *req) /* Not sure if we need this. */ ocf_req_get(req); - /* Set resume io_if */ - req->io_if = &_io_if_wb_resume; + /* Set resume handler */ + req->engine_handler = ocf_write_wb_do; req->engine_cbs = &_wb_engine_callbacks; /* TODO: Handle fits into dirty */ @@ -204,7 +195,7 @@ int ocf_write_wb(struct ocf_request *req) } } else { ocf_req_clear(req); - ocf_get_io_if(ocf_cache_mode_pt)->write(req); + ocf_write_wi(req); } /* Put OCF request - decrease reference counter */ diff --git a/src/engine/engine_wi.c b/src/engine/engine_wi.c index fea1c50..bc6def5 100644 --- a/src/engine/engine_wi.c +++ b/src/engine/engine_wi.c @@ -1,5 +1,5 @@ /* - * Copyright(c) 2012-2021 Intel Corporation + * Copyright(c) 2012-2022 Intel Corporation * SPDX-License-Identifier: BSD-3-Clause */ @@ -16,13 +16,6 @@ #define OCF_ENGINE_DEBUG_IO_NAME "wi" #include "engine_debug.h" -static int ocf_write_wi_update_and_flush_metadata(struct ocf_request *req); - -static const struct ocf_io_if _io_if_wi_update_metadata = { - .read = ocf_write_wi_update_and_flush_metadata, - .write = ocf_write_wi_update_and_flush_metadata, -}; - int _ocf_write_wi_next_pass(struct ocf_request *req) { ocf_req_unlock_wr(ocf_cache_line_concurrency(req->cache), req); @@ -50,11 +43,6 @@ int _ocf_write_wi_next_pass(struct ocf_request *req) return 0; } -static const struct ocf_io_if _io_if_wi_next_pass = { - .read = _ocf_write_wi_next_pass, - .write = _ocf_write_wi_next_pass, -}; - static void _ocf_write_wi_io_flush_metadata(struct ocf_request *req, int error) { if (error) { @@ -67,7 +55,7 @@ static void _ocf_write_wi_io_flush_metadata(struct ocf_request *req, int error) if (!req->error && !req->wi_second_pass && ocf_engine_is_miss(req)) { /* need another pass */ - ocf_engine_push_req_front_if(req, &_io_if_wi_next_pass, + ocf_engine_push_req_front_cb(req, _ocf_write_wi_next_pass, true); return; } @@ -134,8 +122,8 @@ static void _ocf_write_wi_core_complete(struct ocf_request *req, int error) ocf_req_put(req); } else { - ocf_engine_push_req_front_if(req, &_io_if_wi_update_metadata, - true); + ocf_engine_push_req_front_cb(req, + ocf_write_wi_update_and_flush_metadata, true); } } @@ -169,11 +157,6 @@ static void _ocf_write_wi_on_resume(struct ocf_request *req) ocf_engine_push_req_front(req, true); } -static const struct ocf_io_if _io_if_wi_core_write = { - .read = _ocf_write_wi_core_write, - .write = _ocf_write_wi_core_write, -}; - int ocf_write_wi(struct ocf_request *req) { int lock = OCF_LOCK_NOT_ACQUIRED; @@ -185,10 +168,10 @@ int ocf_write_wi(struct ocf_request *req) /* Get OCF request - increase reference counter */ ocf_req_get(req); - /* Set resume io_if */ - req->io_if = req->wi_second_pass ? - &_io_if_wi_update_metadata : - &_io_if_wi_core_write; + /* Set resume handler */ + req->engine_handler = req->wi_second_pass ? + ocf_write_wi_update_and_flush_metadata : + _ocf_write_wi_core_write; ocf_req_hash(req); ocf_hb_req_prot_lock_rd(req); /*- Metadata READ access, No eviction --------*/ @@ -209,7 +192,7 @@ int ocf_write_wi(struct ocf_request *req) if (lock >= 0) { if (lock == OCF_LOCK_ACQUIRED) { - req->io_if->write(req); + req->engine_handler(req); } else { /* WR lock was not acquired, need to wait for resume */ OCF_DEBUG_RQ(req, "NO LOCK"); diff --git a/src/engine/engine_wo.c b/src/engine/engine_wo.c index a5b0fd2..df056bf 100644 --- a/src/engine/engine_wo.c +++ b/src/engine/engine_wo.c @@ -150,11 +150,6 @@ static int ocf_read_wo_cache_do(struct ocf_request *req) return 0; } -static const struct ocf_io_if _io_if_wo_cache_read = { - .read = ocf_read_wo_cache_do, - .write = ocf_read_wo_cache_do, -}; - static void _ocf_read_wo_core_complete(struct ocf_request *req, int error) { if (error) { @@ -173,7 +168,7 @@ static void _ocf_read_wo_core_complete(struct ocf_request *req, int error) return; } - req->io_if = &_io_if_wo_cache_read; + req->engine_handler = ocf_read_wo_cache_do; ocf_engine_push_req_front(req, true); } @@ -206,11 +201,6 @@ int ocf_read_wo_do(struct ocf_request *req) return 0; } -static const struct ocf_io_if _io_if_wo_resume = { - .read = ocf_read_wo_do, - .write = ocf_read_wo_do, -}; - int ocf_read_wo(struct ocf_request *req) { int lock = OCF_LOCK_ACQUIRED; @@ -223,7 +213,7 @@ int ocf_read_wo(struct ocf_request *req) ocf_req_get(req); /* Set resume call backs */ - req->io_if = &_io_if_wo_resume; + req->engine_handler = ocf_read_wo_do; ocf_req_hash(req); ocf_hb_req_prot_lock_rd(req); /*- Metadata RD access -----------------------*/ diff --git a/src/engine/engine_wt.c b/src/engine/engine_wt.c index f626f2a..c824999 100644 --- a/src/engine/engine_wt.c +++ b/src/engine/engine_wt.c @@ -1,11 +1,12 @@ /* - * Copyright(c) 2012-2021 Intel Corporation + * Copyright(c) 2012-2022 Intel Corporation * SPDX-License-Identifier: BSD-3-Clause */ #include "ocf/ocf.h" #include "../ocf_cache_priv.h" #include "engine_wt.h" +#include "engine_wi.h" #include "engine_inv.h" #include "engine_common.h" #include "../ocf_request.h" @@ -91,11 +92,6 @@ static int ocf_write_wt_do_flush_metadata(struct ocf_request *req) return 0; } -static const struct ocf_io_if _io_if_wt_flush_metadata = { - .read = ocf_write_wt_do_flush_metadata, - .write = ocf_write_wt_do_flush_metadata, -}; - static void _ocf_write_wt_req_complete(struct ocf_request *req) { if (env_atomic_dec_return(&req->req_remaining)) @@ -116,7 +112,8 @@ static void _ocf_write_wt_req_complete(struct ocf_request *req) if (req->info.dirty_any) { /* Some of the request's cachelines changed its state to clean */ - ocf_engine_push_req_front_if(req, &_io_if_wt_flush_metadata, true); + ocf_engine_push_req_front_cb(req, + ocf_write_wt_do_flush_metadata, true); } else { ocf_req_unlock_wr(ocf_cache_line_concurrency(req->cache), req); @@ -195,11 +192,6 @@ static int _ocf_write_wt_do(struct ocf_request *req) return 0; } -static const struct ocf_io_if _io_if_wt_resume = { - .read = _ocf_write_wt_do, - .write = _ocf_write_wt_do, -}; - static const struct ocf_engine_callbacks _wt_engine_callbacks = { .resume = ocf_engine_on_resume, @@ -214,8 +206,8 @@ int ocf_write_wt(struct ocf_request *req) /* Get OCF request - increase reference counter */ ocf_req_get(req); - /* Set resume io_if */ - req->io_if = &_io_if_wt_resume; + /* Set resume handler */ + req->engine_handler = _ocf_write_wt_do; req->engine_cbs = &_wt_engine_callbacks; lock = ocf_engine_prepare_clines(req); @@ -235,7 +227,7 @@ int ocf_write_wt(struct ocf_request *req) } } else { ocf_req_clear(req); - ocf_get_io_if(ocf_cache_mode_pt)->write(req); + ocf_write_wi(req); } /* Put OCF request - decrease reference counter */ diff --git a/src/engine/engine_zero.c b/src/engine/engine_zero.c index 3c7ce5a..5d6352b 100644 --- a/src/engine/engine_zero.c +++ b/src/engine/engine_zero.c @@ -1,5 +1,5 @@ /* - * Copyright(c) 2012-2021 Intel Corporation + * Copyright(c) 2012-2022 Intel Corporation * SPDX-License-Identifier: BSD-3-Clause */ @@ -40,11 +40,6 @@ static int ocf_zero_purge(struct ocf_request *req) return 0; } -static const struct ocf_io_if _io_if_zero_purge = { - .read = ocf_zero_purge, - .write = ocf_zero_purge, -}; - static void _ocf_zero_io_flush_metadata(struct ocf_request *req, int error) { if (error) { @@ -55,7 +50,7 @@ static void _ocf_zero_io_flush_metadata(struct ocf_request *req, int error) if (env_atomic_dec_return(&req->req_remaining)) return; - ocf_engine_push_req_front_if(req, &_io_if_zero_purge, true); + ocf_engine_push_req_front_cb(req, ocf_zero_purge, true); } static inline void ocf_zero_map_info(struct ocf_request *req) @@ -124,11 +119,6 @@ static int _ocf_zero_do(struct ocf_request *req) return 0; } -static const struct ocf_io_if _io_if_ocf_zero_do = { - .read = _ocf_zero_do, - .write = _ocf_zero_do, -}; - /** * @note * - Caller has to have metadata write lock @@ -149,7 +139,7 @@ void ocf_engine_zero_line(struct ocf_request *req) ENV_BUG_ON(!ocf_engine_is_mapped(req)); - req->io_if = &_io_if_ocf_zero_do; + req->engine_handler = _ocf_zero_do; /* Some cache line are mapped, lock request for WRITE access */ lock = ocf_req_async_lock_wr( @@ -158,7 +148,7 @@ void ocf_engine_zero_line(struct ocf_request *req) if (lock >= 0) { ENV_BUG_ON(lock != OCF_LOCK_ACQUIRED); - ocf_engine_push_req_front_if(req, &_io_if_ocf_zero_do, true); + ocf_engine_push_req_front_cb(req, _ocf_zero_do, true); } else { OCF_DEBUG_RQ(req, "LOCK ERROR %d", lock); req->complete(req, lock); diff --git a/src/metadata/metadata_io.c b/src/metadata/metadata_io.c index c28d29e..420f0c6 100644 --- a/src/metadata/metadata_io.c +++ b/src/metadata/metadata_io.c @@ -137,11 +137,6 @@ int metadata_io_read_i_atomic_step(struct ocf_request *req) return 0; } -static const struct ocf_io_if _io_if_metadata_io_read_i_atomic_step = { - .read = metadata_io_read_i_atomic_step, - .write = metadata_io_read_i_atomic_step, -}; - /* * Iterative read request */ @@ -166,7 +161,7 @@ int metadata_io_read_i_atomic(ocf_cache_t cache, ocf_queue_t queue, void *priv, } context->req->info.internal = true; - context->req->io_if = &_io_if_metadata_io_read_i_atomic_step; + context->req->engine_handler = metadata_io_read_i_atomic_step; context->req->priv = context; /* Allocate one 4k page for metadata*/ @@ -262,11 +257,6 @@ static int metadata_io_do(struct ocf_request *req) return 0; } -static struct ocf_io_if metadata_io_do_if = { - .read = metadata_io_do, - .write = metadata_io_do, -}; - void metadata_io_req_finalize(struct metadata_io_request *m_req) { struct metadata_io_request_asynch *a_req = m_req->asynch; @@ -287,7 +277,7 @@ static int metadata_io_restart_req(struct ocf_request *req) struct metadata_io_request_asynch *a_req = m_req->asynch; int lock; - m_req->req.io_if = &metadata_io_do_if; + m_req->req.engine_handler = metadata_io_do; if (!a_req->mio_conc) { metadata_io_do(&m_req->req); @@ -309,11 +299,6 @@ static int metadata_io_restart_req(struct ocf_request *req) return 0; } -static struct ocf_io_if metadata_io_restart_if = { - .read = metadata_io_restart_req, - .write = metadata_io_restart_req, -}; - static void metadata_io_req_advance(struct metadata_io_request *m_req); /* @@ -414,7 +399,7 @@ void metadata_io_req_complete(struct metadata_io_request *m_req) return; } - m_req->req.io_if = &metadata_io_restart_if; + m_req->req.engine_handler = metadata_io_restart_req; ocf_engine_push_req_front(&m_req->req, true); } @@ -463,7 +448,7 @@ static int metadata_io_i_asynch(ocf_cache_t cache, ocf_queue_t queue, int dir, m_req->asynch = a_req; m_req->cache = cache; m_req->context = context; - m_req->req.io_if = &metadata_io_restart_if; + m_req->req.engine_handler = metadata_io_restart_req; m_req->req.io_queue = queue; m_req->req.cache = cache; m_req->req.priv = m_req; diff --git a/src/metadata/metadata_passive_update.c b/src/metadata/metadata_passive_update.c index 45e54e7..8e84a6a 100644 --- a/src/metadata/metadata_passive_update.c +++ b/src/metadata/metadata_passive_update.c @@ -1,5 +1,5 @@ /* - * Copyright(c) 2012-2021 Intel Corporation + * Copyright(c) 2012-2022 Intel Corporation * SPDX-License-Identifier: BSD-3-Clause */ @@ -68,11 +68,6 @@ static int passive_io_resume(struct ocf_request *req) return 0; } -static struct ocf_io_if passive_io_restart_if = { - .read = passive_io_resume, - .write = passive_io_resume, -}; - static void passive_io_page_lock_acquired(struct ocf_request *req) { ocf_engine_push_req_front(req, true); @@ -120,7 +115,7 @@ int ocf_metadata_passive_update(ocf_cache_t cache, struct ocf_io *io, req->io_queue = io->io_queue;; req->info.internal = true; - req->io_if = &passive_io_restart_if; + req->engine_handler = passive_io_resume; req->rw = OCF_WRITE; req->data = io; req->master_io_req = io_cmpl; diff --git a/src/metadata/metadata_raw_dynamic.c b/src/metadata/metadata_raw_dynamic.c index 50002ae..f25b657 100644 --- a/src/metadata/metadata_raw_dynamic.c +++ b/src/metadata/metadata_raw_dynamic.c @@ -1,5 +1,5 @@ /* - * Copyright(c) 2012-2021 Intel Corporation + * Copyright(c) 2012-2022 Intel Corporation * SPDX-License-Identifier: BSD-3-Clause */ @@ -376,11 +376,6 @@ static void raw_dynamic_load_all_complete( static int raw_dynamic_load_all_update(struct ocf_request *req); -static const struct ocf_io_if _io_if_raw_dynamic_load_all_update = { - .read = raw_dynamic_load_all_update, - .write = raw_dynamic_load_all_update, -}; - static void raw_dynamic_load_all_read_end(struct ocf_io *io, int error) { struct raw_dynamic_load_all_context *context = io->priv1; @@ -392,7 +387,7 @@ static void raw_dynamic_load_all_read_end(struct ocf_io *io, int error) return; } - context->req->io_if = &_io_if_raw_dynamic_load_all_update; + context->req->engine_handler = raw_dynamic_load_all_update; ocf_engine_push_req_front(context->req, true); } @@ -436,11 +431,6 @@ static int raw_dynamic_load_all_read(struct ocf_request *req) return 0; } -static const struct ocf_io_if _io_if_raw_dynamic_load_all_read = { - .read = raw_dynamic_load_all_read, - .write = raw_dynamic_load_all_read, -}; - static int raw_dynamic_load_all_update(struct ocf_request *req) { struct raw_dynamic_load_all_context *context = req->priv; @@ -463,7 +453,7 @@ static int raw_dynamic_load_all_update(struct ocf_request *req) return 0; } - context->req->io_if = &_io_if_raw_dynamic_load_all_read; + context->req->engine_handler = raw_dynamic_load_all_read; ocf_engine_push_req_front(context->req, true); return 0; @@ -508,7 +498,7 @@ void raw_dynamic_load_all(ocf_cache_t cache, struct ocf_metadata_raw *raw, context->req->info.internal = true; context->req->priv = context; - context->req->io_if = &_io_if_raw_dynamic_load_all_read; + context->req->engine_handler = raw_dynamic_load_all_read; ocf_engine_push_req_front(context->req, true); return; diff --git a/src/mngt/ocf_mngt_flush.c b/src/mngt/ocf_mngt_flush.c index e45bf22..5702ffc 100644 --- a/src/mngt/ocf_mngt_flush.c +++ b/src/mngt/ocf_mngt_flush.c @@ -1,5 +1,5 @@ /* - * Copyright(c) 2012-2021 Intel Corporation + * Copyright(c) 2012-2022 Intel Corporation * SPDX-License-Identifier: BSD-3-Clause */ @@ -417,11 +417,6 @@ static int _ofc_flush_container_step(struct ocf_request *req) return 0; } -static const struct ocf_io_if _io_if_flush_portion = { - .read = _ofc_flush_container_step, - .write = _ofc_flush_container_step, -}; - static void _ocf_mngt_flush_container( struct ocf_mngt_cache_flush_context *context, struct flush_container *fc, ocf_flush_containter_coplete_t end) @@ -443,7 +438,7 @@ static void _ocf_mngt_flush_container( } req->info.internal = true; - req->io_if = &_io_if_flush_portion; + req->engine_handler = _ofc_flush_container_step; req->priv = fc; fc->req = req; diff --git a/src/ocf_queue.c b/src/ocf_queue.c index 717dee3..120ed75 100644 --- a/src/ocf_queue.c +++ b/src/ocf_queue.c @@ -1,5 +1,5 @@ /* - * Copyright(c) 2012-2021 Intel Corporation + * Copyright(c) 2012-2022 Intel Corporation * SPDX-License-Identifier: BSD-3-Clause */ #include "ocf/ocf.h" @@ -85,10 +85,7 @@ void ocf_io_handle(struct ocf_io *io, void *opaque) OCF_CHECK_NULL(req); - if (req->rw == OCF_WRITE) - req->io_if->write(req); - else - req->io_if->read(req); + req->engine_handler(req); } void ocf_queue_run_single(ocf_queue_t q) diff --git a/src/ocf_request.h b/src/ocf_request.h index 92e88ef..4725290 100644 --- a/src/ocf_request.h +++ b/src/ocf_request.h @@ -1,5 +1,5 @@ /* - * Copyright(c) 2012-2021 Intel Corporation + * Copyright(c) 2012-2022 Intel Corporation * SPDX-License-Identifier: BSD-3-Clause */ @@ -128,8 +128,8 @@ struct ocf_request { ocf_core_t core; /*!< Handle to core instance */ - const struct ocf_io_if *io_if; - /*!< IO interface */ + ocf_engine_cb engine_handler; + /*!< IO engine handler */ void *priv; /*!< Filed for private data, context */ diff --git a/src/utils/utils_cleaner.c b/src/utils/utils_cleaner.c index aec5ae9..dcca1aa 100644 --- a/src/utils/utils_cleaner.c +++ b/src/utils/utils_cleaner.c @@ -293,11 +293,6 @@ static int _ocf_cleaner_fire_flush_cache(struct ocf_request *req) return 0; } -static const struct ocf_io_if _io_if_flush_cache = { - .read = _ocf_cleaner_fire_flush_cache, - .write = _ocf_cleaner_fire_flush_cache, -}; - static void _ocf_cleaner_metadata_io_end(struct ocf_request *req, int error) { if (error) { @@ -309,7 +304,7 @@ static void _ocf_cleaner_metadata_io_end(struct ocf_request *req, int error) OCF_DEBUG_MSG(req->cache, "Metadata flush finished"); - req->io_if = &_io_if_flush_cache; + req->engine_handler = _ocf_cleaner_fire_flush_cache; ocf_engine_push_req_front(req, true); } @@ -361,11 +356,6 @@ static int _ocf_cleaner_update_metadata(struct ocf_request *req) return 0; } -static const struct ocf_io_if _io_if_update_metadata = { - .read = _ocf_cleaner_update_metadata, - .write = _ocf_cleaner_update_metadata, -}; - static void _ocf_cleaner_flush_cores_io_end(struct ocf_map_info *map, struct ocf_request *req, int error) { @@ -393,7 +383,7 @@ static void _ocf_cleaner_flush_cores_io_end(struct ocf_map_info *map, /* * All core writes done, switch to post cleaning activities */ - req->io_if = &_io_if_update_metadata; + req->engine_handler = _ocf_cleaner_update_metadata; ocf_engine_push_req_front(req, true); } @@ -454,11 +444,6 @@ static int _ocf_cleaner_fire_flush_cores(struct ocf_request *req) return 0; } -static const struct ocf_io_if _io_if_flush_cores = { - .read = _ocf_cleaner_fire_flush_cores, - .write = _ocf_cleaner_fire_flush_cores, -}; - static void _ocf_cleaner_core_io_end(struct ocf_request *req) { if (env_atomic_dec_return(&req->req_remaining)) @@ -470,7 +455,7 @@ static void _ocf_cleaner_core_io_end(struct ocf_request *req) * All cache read requests done, now we can submit writes to cores, * Move processing to thread, where IO will be (and can be) submitted */ - req->io_if = &_io_if_flush_cores; + req->engine_handler = _ocf_cleaner_fire_flush_cores; ocf_engine_push_req_front(req, true); } @@ -619,11 +604,6 @@ static int _ocf_cleaner_fire_core(struct ocf_request *req) return 0; } -static const struct ocf_io_if _io_if_fire_core = { - .read = _ocf_cleaner_fire_core, - .write = _ocf_cleaner_fire_core, -}; - static void _ocf_cleaner_cache_io_end(struct ocf_request *req) { if (env_atomic_dec_return(&req->req_remaining)) @@ -633,7 +613,7 @@ static void _ocf_cleaner_cache_io_end(struct ocf_request *req) * All cache read requests done, now we can submit writes to cores, * Move processing to thread, where IO will be (and can be) submitted */ - req->io_if = &_io_if_fire_core; + req->engine_handler = _ocf_cleaner_fire_core; ocf_engine_push_req_front(req, true); OCF_DEBUG_MSG(req->cache, "Cache reads finished"); @@ -723,16 +703,11 @@ static int _ocf_cleaner_fire_cache(struct ocf_request *req) return 0; } -static const struct ocf_io_if _io_if_fire_cache = { - .read = _ocf_cleaner_fire_cache, - .write = _ocf_cleaner_fire_cache, -}; - static int _ocf_cleaner_fire(struct ocf_request *req) { int result; - req->io_if = &_io_if_fire_cache; + req->engine_handler = _ocf_cleaner_fire_cache; /* Handle cache lines locks */ result = _ocf_cleaner_cache_line_lock(req); diff --git a/src/utils/utils_parallelize.c b/src/utils/utils_parallelize.c index 7c5b129..8265aa5 100644 --- a/src/utils/utils_parallelize.c +++ b/src/utils/utils_parallelize.c @@ -1,5 +1,5 @@ /* - * Copyright(c) 2012-2021 Intel Corporation + * Copyright(c) 2012-2022 Intel Corporation * SPDX-License-Identifier: BSD-3-Clause */ @@ -46,11 +46,6 @@ static int _ocf_parallelize_hndl(struct ocf_request *req) return 0; } -static const struct ocf_io_if _io_if_parallelize = { - .read = _ocf_parallelize_hndl, - .write = _ocf_parallelize_hndl, -}; - int ocf_parallelize_create(ocf_parallelize_t *parallelize, ocf_cache_t cache, unsigned shards_cnt, uint32_t priv_size, ocf_parallelize_handle_t handle, @@ -97,7 +92,8 @@ int ocf_parallelize_create(ocf_parallelize_t *parallelize, goto err_reqs; } tmp_parallelize->reqs[i]->info.internal = true; - tmp_parallelize->reqs[i]->io_if = &_io_if_parallelize; + tmp_parallelize->reqs[i]->engine_handler = + _ocf_parallelize_hndl; tmp_parallelize->reqs[i]->byte_position = i; tmp_parallelize->reqs[i]->priv = tmp_parallelize; i++; diff --git a/src/utils/utils_pipeline.c b/src/utils/utils_pipeline.c index 5c4baef..45a37e5 100644 --- a/src/utils/utils_pipeline.c +++ b/src/utils/utils_pipeline.c @@ -67,11 +67,6 @@ static int _ocf_pipeline_run_step(struct ocf_request *req) return 0; } -static const struct ocf_io_if _io_if_pipeline = { - .read = _ocf_pipeline_run_step, - .write = _ocf_pipeline_run_step, -}; - int ocf_pipeline_create(ocf_pipeline_t *pipeline, ocf_cache_t cache, struct ocf_pipeline_properties *properties) { @@ -101,7 +96,7 @@ int ocf_pipeline_create(ocf_pipeline_t *pipeline, ocf_cache_t cache, tmp_pipeline->error = 0; req->info.internal = true; - req->io_if = &_io_if_pipeline; + req->engine_handler = _ocf_pipeline_run_step; req->priv = tmp_pipeline; *pipeline = tmp_pipeline;