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 * 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] = { static const struct ocf_io_if IO_IFS[OCF_IO_PRIV_MAX_IF] = {
[OCF_IO_WT_IF] = { [OCF_IO_WT_IF] = {
.read = ocf_read_generic, .cbs = {
.write = ocf_write_wt, [OCF_READ] = ocf_read_generic,
[OCF_WRITE] = ocf_write_wt,
},
.name = "Write Through" .name = "Write Through"
}, },
[OCF_IO_WB_IF] = { [OCF_IO_WB_IF] = {
.read = ocf_read_generic, .cbs = {
.write = ocf_write_wb, [OCF_READ] = ocf_read_generic,
[OCF_WRITE] = ocf_write_wb,
},
.name = "Write Back" .name = "Write Back"
}, },
[OCF_IO_WA_IF] = { [OCF_IO_WA_IF] = {
.read = ocf_read_generic, .cbs = {
.write = ocf_write_wa, [OCF_READ] = ocf_read_generic,
[OCF_WRITE] = ocf_write_wa,
},
.name = "Write Around" .name = "Write Around"
}, },
[OCF_IO_WI_IF] = { [OCF_IO_WI_IF] = {
.read = ocf_read_generic, .cbs = {
.write = ocf_write_wi, [OCF_READ] = ocf_read_generic,
[OCF_WRITE] = ocf_write_wi,
},
.name = "Write Invalidate" .name = "Write Invalidate"
}, },
[OCF_IO_PT_IF] = { [OCF_IO_PT_IF] = {
.read = ocf_read_pt, .cbs = {
.write = ocf_write_wi, [OCF_READ] = ocf_read_pt,
[OCF_WRITE] = ocf_write_wi,
},
.name = "Pass Through", .name = "Pass Through",
}, },
[OCF_IO_WO_IF] = { [OCF_IO_WO_IF] = {
.read = ocf_read_wo, .cbs = {
.write = ocf_write_wb, [OCF_READ] = ocf_read_wo,
[OCF_WRITE] = ocf_write_wb,
},
.name = "Write Only", .name = "Write Only",
}, },
[OCF_IO_FAST_IF] = { [OCF_IO_FAST_IF] = {
.read = ocf_read_fast, .cbs = {
.write = ocf_write_fast, [OCF_READ] = ocf_read_fast,
[OCF_WRITE] = ocf_write_fast,
},
.name = "Fast", .name = "Fast",
}, },
[OCF_IO_DISCARD_IF] = { [OCF_IO_DISCARD_IF] = {
.read = ocf_discard, .cbs = {
.write = ocf_discard, [OCF_READ] = ocf_discard,
[OCF_WRITE] = ocf_discard,
},
.name = "Discard", .name = "Discard",
}, },
[OCF_IO_D2C_IF] = { [OCF_IO_D2C_IF] = {
.read = ocf_io_d2c, .cbs = {
.write = ocf_io_d2c, [OCF_READ] = ocf_io_d2c,
[OCF_WRITE] = ocf_io_d2c,
},
.name = "Direct to core", .name = "Direct to core",
}, },
[OCF_IO_OPS_IF] = { [OCF_IO_OPS_IF] = {
.read = ocf_engine_ops, .cbs = {
.write = ocf_engine_ops, [OCF_READ] = ocf_engine_ops,
[OCF_WRITE] = ocf_engine_ops,
},
.name = "Ops engine", .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], [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) if (req_cache_mode == ocf_req_cache_mode_max)
return NULL; 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) 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); OCF_CHECK_NULL(cache);
req->io_if = ocf_get_io_if(req->cache_mode); req->engine_handler = ocf_cache_mode_to_engine_cb(req->cache_mode,
if (!req->io_if) req->rw);
if (!req->engine_handler)
return -OCF_ERR_INVAL; return -OCF_ERR_INVAL;
ocf_req_get(req); 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) int ocf_engine_hndl_fast_req(struct ocf_request *req)
{ {
const struct ocf_io_if *io_if; ocf_engine_cb engine_cb;
int ret; int ret;
io_if = ocf_get_io_if(req->cache_mode); engine_cb = ocf_cache_mode_to_engine_cb(req->cache_mode, req->rw);
if (!io_if) if (!engine_cb)
return -OCF_ERR_INVAL; return -OCF_ERR_INVAL;
ocf_req_get(req); ocf_req_get(req);
switch (req->rw) { ret = engine_cb(req);
case OCF_READ:
ret = io_if->read(req);
break;
case OCF_WRITE:
ret = io_if->write(req);
break;
default:
ret = OCF_FAST_PATH_NO;
}
if (ret == OCF_FAST_PATH_NO) if (ret == OCF_FAST_PATH_NO)
ocf_req_put(req); 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) static void ocf_engine_hndl_2dc_req(struct ocf_request *req)
{ {
if (OCF_READ == req->rw) IO_IFS[OCF_IO_D2C_IF].cbs[req->rw](req);
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();
} }
void ocf_engine_hndl_discard_req(struct ocf_request *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; return;
} }
if (OCF_READ == req->rw) IO_IFS[OCF_IO_DISCARD_IF].cbs[req->rw](req);
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();
} }
void ocf_engine_hndl_ops_req(struct ocf_request *req) void ocf_engine_hndl_ops_req(struct ocf_request *req)
{ {
ocf_req_get(req); ocf_req_get(req);
if (req->d2c) req->engine_handler = (req->d2c) ?
req->io_if = &IO_IFS[OCF_IO_D2C_IF]; ocf_io_if_type_to_engine_cb(OCF_IO_D2C_IF, req->rw) :
else ocf_io_if_type_to_engine_cb(OCF_IO_OPS_IF, req->rw);
req->io_if = &IO_IFS[OCF_IO_OPS_IF];
ocf_engine_push_req_back(req, true); ocf_engine_push_req_back(req, true);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright(c) 2012-2021 Intel Corporation * Copyright(c) 2012-2022 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -32,10 +32,10 @@ typedef enum {
ocf_req_cache_mode_max, ocf_req_cache_mode_max,
} ocf_req_cache_mode_t; } ocf_req_cache_mode_t;
struct ocf_io_if { typedef int (*ocf_engine_cb)(struct ocf_request *req);
int (*read)(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; const char *name;
}; };
@ -43,14 +43,7 @@ struct ocf_io_if {
void ocf_resolve_effective_cache_mode(ocf_cache_t cache, void ocf_resolve_effective_cache_mode(ocf_cache_t cache,
ocf_core_t core, struct ocf_request *req); ocf_core_t core, struct ocf_request *req);
const struct ocf_io_if *ocf_get_io_if(ocf_req_cache_mode_t cache_mode); const char *ocf_get_io_iface_name(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";
}
bool ocf_req_cache_mode_has_lazy_write(ocf_req_cache_mode_t mode); bool ocf_req_cache_mode_has_lazy_write(ocf_req_cache_mode_t mode);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright(c) 2012-2021 Intel Corporation * Copyright(c) 2012-2022 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -90,13 +90,8 @@ static int _ocf_backfill_do(struct ocf_request *req)
return 0; 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) void ocf_engine_backfill(struct ocf_request *req)
{ {
backfill_queue_inc_block(req->cache); 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);
} }

View File

@ -644,12 +644,12 @@ void ocf_engine_push_req_front(struct ocf_request *req, bool allow_sync)
ocf_queue_kick(q, allow_sync); ocf_queue_kick(q, allow_sync);
} }
void ocf_engine_push_req_front_if(struct ocf_request *req, void ocf_engine_push_req_front_cb(struct ocf_request *req,
const struct ocf_io_if *io_if, ocf_engine_cb engine_cb,
bool allow_sync) bool allow_sync)
{ {
req->error = 0; /* Please explain why!!! */ req->error = 0; /* Please explain why!!! */
req->io_if = io_if; req->engine_handler = engine_cb;
ocf_engine_push_req_front(req, allow_sync); ocf_engine_push_req_front(req, allow_sync);
} }
@ -681,16 +681,10 @@ static int _ocf_engine_refresh(struct ocf_request *req)
if (result == 0) { if (result == 0) {
/* Refresh successful, can process with original IO interface */ /* Refresh successful, can process with original IO interface */
req->io_if = req->priv; req->engine_handler = req->priv;
req->priv = NULL; req->priv = NULL;
if (req->rw == OCF_READ) req->engine_handler(req);
req->io_if->read(req);
else if (req->rw == OCF_WRITE)
req->io_if->write(req);
else
ENV_BUG();
} else { } else {
ENV_WARN(true, "Inconsistent request"); ENV_WARN(true, "Inconsistent request");
req->error = -OCF_ERR_INVAL; req->error = -OCF_ERR_INVAL;
@ -708,20 +702,15 @@ static int _ocf_engine_refresh(struct ocf_request *req)
return 0; 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) void ocf_engine_on_resume(struct ocf_request *req)
{ {
ENV_BUG_ON(req->priv); ENV_BUG_ON(req->priv);
OCF_CHECK_NULL(req->io_if); OCF_CHECK_NULL(req->engine_handler);
/* Exchange IO interface */ /* Exchange engine handler */
req->priv = (void *)req->io_if; req->priv = (void *)req->engine_handler;
OCF_DEBUG_RQ(req, "On resume"); 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);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright(c) 2012-2021 Intel Corporation * Copyright(c) 2012-2022 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause * 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 * @brief Set interface and push from request to the OCF thread worker queue
* *
* @param req OCF request * @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 * @param allow_sync caller allows for request from queue to be ran immediately
from push function in caller context from push function in caller context
*/ */
void ocf_engine_push_req_front_if(struct ocf_request *req, void ocf_engine_push_req_front_cb(struct ocf_request *req,
const struct ocf_io_if *io_if, ocf_engine_cb engine_cb,
bool allow_sync); bool allow_sync);
void inc_fallback_pt_error_counter(ocf_cache_t cache); void inc_fallback_pt_error_counter(ocf_cache_t cache);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright(c) 2012-2021 Intel Corporation * Copyright(c) 2012-2022 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include "ocf/ocf.h" #include "ocf/ocf.h"
@ -18,31 +18,6 @@
#define OCF_ENGINE_DEBUG_IO_NAME "discard" #define OCF_ENGINE_DEBUG_IO_NAME "discard"
#include "engine_debug.h" #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) static void _ocf_discard_complete_req(struct ocf_request *req, int error)
{ {
req->complete(req, error); req->complete(req, error);
@ -97,7 +72,7 @@ static void _ocf_discard_cache_flush_complete(struct ocf_io *io, int error)
return; return;
} }
req->io_if = &_io_if_discard_core; req->engine_handler = _ocf_discard_core;
ocf_engine_push_req_front(req, true); ocf_engine_push_req_front(req, true);
ocf_io_put(io); ocf_io_put(io);
@ -122,16 +97,18 @@ static int _ocf_discard_flush_cache(struct ocf_request *req)
return 0; return 0;
} }
static int _ocf_discard_step(struct ocf_request *req);
static void _ocf_discard_finish_step(struct ocf_request *req) static void _ocf_discard_finish_step(struct ocf_request *req)
{ {
req->discard.handled += BYTES_TO_SECTORS(req->byte_length); req->discard.handled += BYTES_TO_SECTORS(req->byte_length);
if (req->discard.handled < req->discard.nr_sects) 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) else if (!req->cache->metadata.is_volatile)
req->io_if = &_io_if_discard_flush_cache; req->engine_handler = _ocf_discard_flush_cache;
else else
req->io_if = &_io_if_discard_core; req->engine_handler = _ocf_discard_core;
ocf_engine_push_req_front(req, true); ocf_engine_push_req_front(req, true);
} }
@ -222,7 +199,7 @@ static int _ocf_discard_step(struct ocf_request *req)
req->core_line_last = req->core_line_last =
ocf_bytes_2_lines(cache, req->byte_position + req->byte_length - 1); 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->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, ENV_BUG_ON(env_memset(req->map, sizeof(*req->map) * req->core_line_count,
0)); 0));

View File

@ -1,5 +1,5 @@
/* /*
* Copyright(c) 2012-2021 Intel Corporation * Copyright(c) 2012-2022 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -99,11 +99,6 @@ static int _ocf_read_fast_do(struct ocf_request *req)
return 0; 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) int ocf_read_fast(struct ocf_request *req)
{ {
bool hit; bool hit;
@ -113,8 +108,8 @@ int ocf_read_fast(struct ocf_request *req)
/* Get OCF request - increase reference counter */ /* Get OCF request - increase reference counter */
ocf_req_get(req); ocf_req_get(req);
/* Set resume io_if */ /* Set resume handler */
req->io_if = &_io_if_read_fast_resume; req->engine_handler = _ocf_read_fast_do;
/*- Metadata RD access -----------------------------------------------*/ /*- 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) int ocf_write_fast(struct ocf_request *req)
{ {
bool mapped; bool mapped;
@ -185,8 +175,8 @@ int ocf_write_fast(struct ocf_request *req)
/* Get OCF request - increase reference counter */ /* Get OCF request - increase reference counter */
ocf_req_get(req); ocf_req_get(req);
/* Set resume io_if */ /* Set resume handler */
req->io_if = &_io_if_write_fast_resume; req->engine_handler = ocf_write_wb_do;
/*- Metadata RD access -----------------------------------------------*/ /*- Metadata RD access -----------------------------------------------*/

View File

@ -1,5 +1,5 @@
/* /*
* Copyright(c) 2012-2021 Intel Corporation * Copyright(c) 2012-2022 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -60,12 +60,7 @@ static int _ocf_invalidate_do(struct ocf_request *req)
return 0; 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) 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);
} }

View File

@ -1,10 +1,11 @@
/* /*
* Copyright(c) 2012-2021 Intel Corporation * Copyright(c) 2012-2022 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include "ocf/ocf.h" #include "ocf/ocf.h"
#include "../ocf_cache_priv.h" #include "../ocf_cache_priv.h"
#include "engine_pt.h" #include "engine_pt.h"
#include "engine_rd.h"
#include "engine_common.h" #include "engine_common.h"
#include "cache_engine.h" #include "cache_engine.h"
#include "../ocf_request.h" #include "../ocf_request.h"
@ -94,11 +95,6 @@ int ocf_read_pt_do(struct ocf_request *req)
return 0; 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) int ocf_read_pt(struct ocf_request *req)
{ {
bool use_cache = false; bool use_cache = false;
@ -111,8 +107,8 @@ int ocf_read_pt(struct ocf_request *req)
/* Get OCF request - increase reference counter */ /* Get OCF request - increase reference counter */
ocf_req_get(req); ocf_req_get(req);
/* Set resume io_if */ /* Set resume handler */
req->io_if = &_io_if_pt_resume; req->engine_handler = ocf_read_pt_do;
ocf_req_hash(req); ocf_req_hash(req);
ocf_hb_req_prot_lock_rd(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 * because of this force read data from cache
*/ */
ocf_req_clear(req); ocf_req_clear(req);
ocf_get_io_if(ocf_cache_mode_wt)->read(req); ocf_read_generic(req);
} else { } else {
if (lock >= 0) { if (lock >= 0) {
if (lock == OCF_LOCK_ACQUIRED) { 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) 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);
} }

View File

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

View File

@ -1,10 +1,12 @@
/* /*
* Copyright(c) 2012-2021 Intel Corporation * Copyright(c) 2012-2022 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include "ocf/ocf.h" #include "ocf/ocf.h"
#include "../ocf_cache_priv.h" #include "../ocf_cache_priv.h"
#include "engine_wa.h" #include "engine_wa.h"
#include "engine_wt.h"
#include "engine_wi.h"
#include "engine_common.h" #include "engine_common.h"
#include "cache_engine.h" #include "cache_engine.h"
#include "../ocf_request.h" #include "../ocf_request.h"
@ -34,13 +36,13 @@ int ocf_write_wa(struct ocf_request *req)
ocf_req_clear(req); ocf_req_clear(req);
/* There is HIT, do WT */ /* There is HIT, do WT */
ocf_get_io_if(ocf_cache_mode_wt)->write(req); ocf_write_wt(req);
} else { } else {
ocf_req_clear(req); ocf_req_clear(req);
/* MISS, do WI */ /* MISS, do WI */
ocf_get_io_if(ocf_cache_mode_wi)->write(req); ocf_write_wi(req);
} }
/* Put OCF request - decrease reference counter */ /* Put OCF request - decrease reference counter */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright(c) 2012-2021 Intel Corporation * Copyright(c) 2012-2022 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -8,6 +8,7 @@
#include "cache_engine.h" #include "cache_engine.h"
#include "engine_common.h" #include "engine_common.h"
#include "engine_wb.h" #include "engine_wb.h"
#include "engine_wi.h"
#include "engine_inv.h" #include "engine_inv.h"
#include "../metadata/metadata.h" #include "../metadata/metadata.h"
#include "../ocf_request.h" #include "../ocf_request.h"
@ -20,11 +21,6 @@
#define OCF_ENGINE_DEBUG_IO_NAME "wb" #define OCF_ENGINE_DEBUG_IO_NAME "wb"
#include "engine_debug.h" #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) static void _ocf_write_wb_update_bits(struct ocf_request *req)
{ {
bool miss = ocf_engine_is_miss(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; 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) static void _ocf_write_wb_complete(struct ocf_request *req, int error)
{ {
if (error) { if (error) {
@ -111,8 +102,8 @@ static void _ocf_write_wb_complete(struct ocf_request *req, int error)
ocf_engine_invalidate(req); ocf_engine_invalidate(req);
} else { } else {
ocf_engine_push_req_front_if(req, &_io_if_wb_flush_metadata, ocf_engine_push_req_front_cb(req,
true); 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. */ /* Not sure if we need this. */
ocf_req_get(req); ocf_req_get(req);
/* Set resume io_if */ /* Set resume handler */
req->io_if = &_io_if_wb_resume; req->engine_handler = ocf_write_wb_do;
req->engine_cbs = &_wb_engine_callbacks; req->engine_cbs = &_wb_engine_callbacks;
/* TODO: Handle fits into dirty */ /* TODO: Handle fits into dirty */
@ -204,7 +195,7 @@ int ocf_write_wb(struct ocf_request *req)
} }
} else { } else {
ocf_req_clear(req); ocf_req_clear(req);
ocf_get_io_if(ocf_cache_mode_pt)->write(req); ocf_write_wi(req);
} }
/* Put OCF request - decrease reference counter */ /* Put OCF request - decrease reference counter */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright(c) 2012-2021 Intel Corporation * Copyright(c) 2012-2022 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -16,13 +16,6 @@
#define OCF_ENGINE_DEBUG_IO_NAME "wi" #define OCF_ENGINE_DEBUG_IO_NAME "wi"
#include "engine_debug.h" #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) int _ocf_write_wi_next_pass(struct ocf_request *req)
{ {
ocf_req_unlock_wr(ocf_cache_line_concurrency(req->cache), 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; 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) static void _ocf_write_wi_io_flush_metadata(struct ocf_request *req, int error)
{ {
if (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)) { if (!req->error && !req->wi_second_pass && ocf_engine_is_miss(req)) {
/* need another pass */ /* 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); true);
return; return;
} }
@ -134,8 +122,8 @@ static void _ocf_write_wi_core_complete(struct ocf_request *req, int error)
ocf_req_put(req); ocf_req_put(req);
} else { } else {
ocf_engine_push_req_front_if(req, &_io_if_wi_update_metadata, ocf_engine_push_req_front_cb(req,
true); 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); 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 ocf_write_wi(struct ocf_request *req)
{ {
int lock = OCF_LOCK_NOT_ACQUIRED; int lock = OCF_LOCK_NOT_ACQUIRED;
@ -185,10 +168,10 @@ int ocf_write_wi(struct ocf_request *req)
/* Get OCF request - increase reference counter */ /* Get OCF request - increase reference counter */
ocf_req_get(req); ocf_req_get(req);
/* Set resume io_if */ /* Set resume handler */
req->io_if = req->wi_second_pass ? req->engine_handler = req->wi_second_pass ?
&_io_if_wi_update_metadata : ocf_write_wi_update_and_flush_metadata :
&_io_if_wi_core_write; _ocf_write_wi_core_write;
ocf_req_hash(req); ocf_req_hash(req);
ocf_hb_req_prot_lock_rd(req); /*- Metadata READ access, No eviction --------*/ 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 >= 0) {
if (lock == OCF_LOCK_ACQUIRED) { if (lock == OCF_LOCK_ACQUIRED) {
req->io_if->write(req); req->engine_handler(req);
} else { } else {
/* WR lock was not acquired, need to wait for resume */ /* WR lock was not acquired, need to wait for resume */
OCF_DEBUG_RQ(req, "NO LOCK"); OCF_DEBUG_RQ(req, "NO LOCK");

View File

@ -150,11 +150,6 @@ static int ocf_read_wo_cache_do(struct ocf_request *req)
return 0; 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) static void _ocf_read_wo_core_complete(struct ocf_request *req, int error)
{ {
if (error) { if (error) {
@ -173,7 +168,7 @@ static void _ocf_read_wo_core_complete(struct ocf_request *req, int error)
return; return;
} }
req->io_if = &_io_if_wo_cache_read; req->engine_handler = ocf_read_wo_cache_do;
ocf_engine_push_req_front(req, true); ocf_engine_push_req_front(req, true);
} }
@ -206,11 +201,6 @@ int ocf_read_wo_do(struct ocf_request *req)
return 0; 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 ocf_read_wo(struct ocf_request *req)
{ {
int lock = OCF_LOCK_ACQUIRED; int lock = OCF_LOCK_ACQUIRED;
@ -223,7 +213,7 @@ int ocf_read_wo(struct ocf_request *req)
ocf_req_get(req); ocf_req_get(req);
/* Set resume call backs */ /* Set resume call backs */
req->io_if = &_io_if_wo_resume; req->engine_handler = ocf_read_wo_do;
ocf_req_hash(req); ocf_req_hash(req);
ocf_hb_req_prot_lock_rd(req); /*- Metadata RD access -----------------------*/ ocf_hb_req_prot_lock_rd(req); /*- Metadata RD access -----------------------*/

View File

@ -1,11 +1,12 @@
/* /*
* Copyright(c) 2012-2021 Intel Corporation * Copyright(c) 2012-2022 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include "ocf/ocf.h" #include "ocf/ocf.h"
#include "../ocf_cache_priv.h" #include "../ocf_cache_priv.h"
#include "engine_wt.h" #include "engine_wt.h"
#include "engine_wi.h"
#include "engine_inv.h" #include "engine_inv.h"
#include "engine_common.h" #include "engine_common.h"
#include "../ocf_request.h" #include "../ocf_request.h"
@ -91,11 +92,6 @@ static int ocf_write_wt_do_flush_metadata(struct ocf_request *req)
return 0; 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) static void _ocf_write_wt_req_complete(struct ocf_request *req)
{ {
if (env_atomic_dec_return(&req->req_remaining)) 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) { if (req->info.dirty_any) {
/* Some of the request's cachelines changed its state to clean */ /* 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 { } else {
ocf_req_unlock_wr(ocf_cache_line_concurrency(req->cache), req); 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; 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 = static const struct ocf_engine_callbacks _wt_engine_callbacks =
{ {
.resume = ocf_engine_on_resume, .resume = ocf_engine_on_resume,
@ -214,8 +206,8 @@ int ocf_write_wt(struct ocf_request *req)
/* Get OCF request - increase reference counter */ /* Get OCF request - increase reference counter */
ocf_req_get(req); ocf_req_get(req);
/* Set resume io_if */ /* Set resume handler */
req->io_if = &_io_if_wt_resume; req->engine_handler = _ocf_write_wt_do;
req->engine_cbs = &_wt_engine_callbacks; req->engine_cbs = &_wt_engine_callbacks;
lock = ocf_engine_prepare_clines(req); lock = ocf_engine_prepare_clines(req);
@ -235,7 +227,7 @@ int ocf_write_wt(struct ocf_request *req)
} }
} else { } else {
ocf_req_clear(req); ocf_req_clear(req);
ocf_get_io_if(ocf_cache_mode_pt)->write(req); ocf_write_wi(req);
} }
/* Put OCF request - decrease reference counter */ /* Put OCF request - decrease reference counter */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright(c) 2012-2021 Intel Corporation * Copyright(c) 2012-2022 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -40,11 +40,6 @@ static int ocf_zero_purge(struct ocf_request *req)
return 0; 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) static void _ocf_zero_io_flush_metadata(struct ocf_request *req, int error)
{ {
if (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)) if (env_atomic_dec_return(&req->req_remaining))
return; 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) 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; return 0;
} }
static const struct ocf_io_if _io_if_ocf_zero_do = {
.read = _ocf_zero_do,
.write = _ocf_zero_do,
};
/** /**
* @note * @note
* - Caller has to have metadata write lock * - 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)); 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 */ /* Some cache line are mapped, lock request for WRITE access */
lock = ocf_req_async_lock_wr( lock = ocf_req_async_lock_wr(
@ -158,7 +148,7 @@ void ocf_engine_zero_line(struct ocf_request *req)
if (lock >= 0) { if (lock >= 0) {
ENV_BUG_ON(lock != OCF_LOCK_ACQUIRED); 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 { } else {
OCF_DEBUG_RQ(req, "LOCK ERROR %d", lock); OCF_DEBUG_RQ(req, "LOCK ERROR %d", lock);
req->complete(req, lock); req->complete(req, lock);

View File

@ -137,11 +137,6 @@ int metadata_io_read_i_atomic_step(struct ocf_request *req)
return 0; 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 * 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->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; context->req->priv = context;
/* Allocate one 4k page for metadata*/ /* Allocate one 4k page for metadata*/
@ -262,11 +257,6 @@ static int metadata_io_do(struct ocf_request *req)
return 0; 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) void metadata_io_req_finalize(struct metadata_io_request *m_req)
{ {
struct metadata_io_request_asynch *a_req = m_req->asynch; 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; struct metadata_io_request_asynch *a_req = m_req->asynch;
int lock; int lock;
m_req->req.io_if = &metadata_io_do_if; m_req->req.engine_handler = metadata_io_do;
if (!a_req->mio_conc) { if (!a_req->mio_conc) {
metadata_io_do(&m_req->req); metadata_io_do(&m_req->req);
@ -309,11 +299,6 @@ static int metadata_io_restart_req(struct ocf_request *req)
return 0; 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); 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; 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); 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->asynch = a_req;
m_req->cache = cache; m_req->cache = cache;
m_req->context = context; 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.io_queue = queue;
m_req->req.cache = cache; m_req->req.cache = cache;
m_req->req.priv = m_req; m_req->req.priv = m_req;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright(c) 2012-2021 Intel Corporation * Copyright(c) 2012-2022 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -68,11 +68,6 @@ static int passive_io_resume(struct ocf_request *req)
return 0; 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) static void passive_io_page_lock_acquired(struct ocf_request *req)
{ {
ocf_engine_push_req_front(req, true); 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->io_queue = io->io_queue;;
req->info.internal = true; req->info.internal = true;
req->io_if = &passive_io_restart_if; req->engine_handler = passive_io_resume;
req->rw = OCF_WRITE; req->rw = OCF_WRITE;
req->data = io; req->data = io;
req->master_io_req = io_cmpl; req->master_io_req = io_cmpl;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright(c) 2012-2021 Intel Corporation * Copyright(c) 2012-2022 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause * 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 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) static void raw_dynamic_load_all_read_end(struct ocf_io *io, int error)
{ {
struct raw_dynamic_load_all_context *context = io->priv1; 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; 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); 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; 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) static int raw_dynamic_load_all_update(struct ocf_request *req)
{ {
struct raw_dynamic_load_all_context *context = req->priv; 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; 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); ocf_engine_push_req_front(context->req, true);
return 0; 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->info.internal = true;
context->req->priv = context; 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); ocf_engine_push_req_front(context->req, true);
return; return;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright(c) 2012-2021 Intel Corporation * Copyright(c) 2012-2022 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -417,11 +417,6 @@ static int _ofc_flush_container_step(struct ocf_request *req)
return 0; 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( static void _ocf_mngt_flush_container(
struct ocf_mngt_cache_flush_context *context, struct ocf_mngt_cache_flush_context *context,
struct flush_container *fc, ocf_flush_containter_coplete_t end) 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->info.internal = true;
req->io_if = &_io_if_flush_portion; req->engine_handler = _ofc_flush_container_step;
req->priv = fc; req->priv = fc;
fc->req = req; fc->req = req;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright(c) 2012-2021 Intel Corporation * Copyright(c) 2012-2022 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include "ocf/ocf.h" #include "ocf/ocf.h"
@ -85,10 +85,7 @@ void ocf_io_handle(struct ocf_io *io, void *opaque)
OCF_CHECK_NULL(req); OCF_CHECK_NULL(req);
if (req->rw == OCF_WRITE) req->engine_handler(req);
req->io_if->write(req);
else
req->io_if->read(req);
} }
void ocf_queue_run_single(ocf_queue_t q) void ocf_queue_run_single(ocf_queue_t q)

View File

@ -1,5 +1,5 @@
/* /*
* Copyright(c) 2012-2021 Intel Corporation * Copyright(c) 2012-2022 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -128,8 +128,8 @@ struct ocf_request {
ocf_core_t core; ocf_core_t core;
/*!< Handle to core instance */ /*!< Handle to core instance */
const struct ocf_io_if *io_if; ocf_engine_cb engine_handler;
/*!< IO interface */ /*!< IO engine handler */
void *priv; void *priv;
/*!< Filed for private data, context */ /*!< Filed for private data, context */

View File

@ -293,11 +293,6 @@ static int _ocf_cleaner_fire_flush_cache(struct ocf_request *req)
return 0; 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) static void _ocf_cleaner_metadata_io_end(struct ocf_request *req, int error)
{ {
if (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"); 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); ocf_engine_push_req_front(req, true);
} }
@ -361,11 +356,6 @@ static int _ocf_cleaner_update_metadata(struct ocf_request *req)
return 0; 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, static void _ocf_cleaner_flush_cores_io_end(struct ocf_map_info *map,
struct ocf_request *req, int error) 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 * 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); ocf_engine_push_req_front(req, true);
} }
@ -454,11 +444,6 @@ static int _ocf_cleaner_fire_flush_cores(struct ocf_request *req)
return 0; 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) static void _ocf_cleaner_core_io_end(struct ocf_request *req)
{ {
if (env_atomic_dec_return(&req->req_remaining)) 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, * All cache read requests done, now we can submit writes to cores,
* Move processing to thread, where IO will be (and can be) submitted * 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); ocf_engine_push_req_front(req, true);
} }
@ -619,11 +604,6 @@ static int _ocf_cleaner_fire_core(struct ocf_request *req)
return 0; 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) static void _ocf_cleaner_cache_io_end(struct ocf_request *req)
{ {
if (env_atomic_dec_return(&req->req_remaining)) 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, * All cache read requests done, now we can submit writes to cores,
* Move processing to thread, where IO will be (and can be) submitted * 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_engine_push_req_front(req, true);
OCF_DEBUG_MSG(req->cache, "Cache reads finished"); OCF_DEBUG_MSG(req->cache, "Cache reads finished");
@ -723,16 +703,11 @@ static int _ocf_cleaner_fire_cache(struct ocf_request *req)
return 0; 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) static int _ocf_cleaner_fire(struct ocf_request *req)
{ {
int result; int result;
req->io_if = &_io_if_fire_cache; req->engine_handler = _ocf_cleaner_fire_cache;
/* Handle cache lines locks */ /* Handle cache lines locks */
result = _ocf_cleaner_cache_line_lock(req); result = _ocf_cleaner_cache_line_lock(req);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright(c) 2012-2021 Intel Corporation * Copyright(c) 2012-2022 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -46,11 +46,6 @@ static int _ocf_parallelize_hndl(struct ocf_request *req)
return 0; 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, int ocf_parallelize_create(ocf_parallelize_t *parallelize,
ocf_cache_t cache, unsigned shards_cnt, uint32_t priv_size, ocf_cache_t cache, unsigned shards_cnt, uint32_t priv_size,
ocf_parallelize_handle_t handle, ocf_parallelize_handle_t handle,
@ -97,7 +92,8 @@ int ocf_parallelize_create(ocf_parallelize_t *parallelize,
goto err_reqs; goto err_reqs;
} }
tmp_parallelize->reqs[i]->info.internal = true; 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]->byte_position = i;
tmp_parallelize->reqs[i]->priv = tmp_parallelize; tmp_parallelize->reqs[i]->priv = tmp_parallelize;
i++; i++;

View File

@ -67,11 +67,6 @@ static int _ocf_pipeline_run_step(struct ocf_request *req)
return 0; 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, int ocf_pipeline_create(ocf_pipeline_t *pipeline, ocf_cache_t cache,
struct ocf_pipeline_properties *properties) 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; tmp_pipeline->error = 0;
req->info.internal = true; req->info.internal = true;
req->io_if = &_io_if_pipeline; req->engine_handler = _ocf_pipeline_run_step;
req->priv = tmp_pipeline; req->priv = tmp_pipeline;
*pipeline = tmp_pipeline; *pipeline = tmp_pipeline;