Rename engine_ops to engine_flush

Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
This commit is contained in:
Robert Baldyga 2023-09-29 10:01:00 +02:00 committed by Michal Mielewczyk
parent fa8c28ca10
commit 1bcd949a89
6 changed files with 29 additions and 27 deletions

View File

@ -19,9 +19,9 @@
#include "engine_wb.h" #include "engine_wb.h"
#include "engine_wo.h" #include "engine_wo.h"
#include "engine_fast.h" #include "engine_fast.h"
#include "engine_flush.h"
#include "engine_discard.h" #include "engine_discard.h"
#include "engine_d2c.h" #include "engine_d2c.h"
#include "engine_ops.h"
#include "../utils/utils_user_part.h" #include "../utils/utils_user_part.h"
#include "../utils/utils_refcnt.h" #include "../utils/utils_refcnt.h"
#include "../ocf_request.h" #include "../ocf_request.h"
@ -40,9 +40,9 @@ enum ocf_io_if_type {
/* Private OCF interfaces */ /* Private OCF interfaces */
OCF_IO_FAST_IF, OCF_IO_FAST_IF,
OCF_IO_FLUSH_IF,
OCF_IO_DISCARD_IF, OCF_IO_DISCARD_IF,
OCF_IO_D2C_IF, OCF_IO_D2C_IF,
OCF_IO_OPS_IF,
OCF_IO_PRIV_MAX_IF, OCF_IO_PRIV_MAX_IF,
}; };
@ -110,10 +110,10 @@ static const struct ocf_io_if IO_IFS[OCF_IO_PRIV_MAX_IF] = {
}, },
.name = "Direct to core", .name = "Direct to core",
}, },
[OCF_IO_OPS_IF] = { [OCF_IO_FLUSH_IF] = {
.cbs = { .cbs = {
[OCF_READ] = ocf_engine_ops, [OCF_READ] = ocf_engine_flush,
[OCF_WRITE] = ocf_engine_ops, [OCF_WRITE] = ocf_engine_flush,
}, },
.name = "Ops engine", .name = "Ops engine",
}, },
@ -274,13 +274,13 @@ void ocf_engine_hndl_discard_req(struct ocf_request *req)
IO_IFS[OCF_IO_DISCARD_IF].cbs[req->rw](req); IO_IFS[OCF_IO_DISCARD_IF].cbs[req->rw](req);
} }
void ocf_engine_hndl_ops_req(struct ocf_request *req) void ocf_engine_hndl_flush_req(struct ocf_request *req)
{ {
ocf_req_get(req); ocf_req_get(req);
req->engine_handler = (req->d2c) ? 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_D2C_IF, req->rw) :
ocf_io_if_type_to_engine_cb(OCF_IO_OPS_IF, req->rw); ocf_io_if_type_to_engine_cb(OCF_IO_FLUSH_IF, req->rw);
ocf_queue_push_req(req, OCF_QUEUE_ALLOW_SYNC); ocf_queue_push_req(req, OCF_QUEUE_ALLOW_SYNC);
} }

View File

@ -43,8 +43,8 @@ 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);
void ocf_engine_hndl_flush_req(struct ocf_request *req);
void ocf_engine_hndl_discard_req(struct ocf_request *req); void ocf_engine_hndl_discard_req(struct ocf_request *req);
void ocf_engine_hndl_ops_req(struct ocf_request *req);
#endif #endif

View File

@ -1,19 +1,20 @@
/* /*
* Copyright(c) 2012-2022 Intel Corporation * Copyright(c) 2012-2022 Intel Corporation
* Copyright(c) 2024 Huawei Technologies
* 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_common.h" #include "engine_common.h"
#include "cache_engine.h" #include "cache_engine.h"
#include "engine_ops.h" #include "engine_flush.h"
#include "../ocf_request.h" #include "../ocf_request.h"
#include "../utils/utils_io.h" #include "../utils/utils_io.h"
#define OCF_ENGINE_DEBUG_IO_NAME "ops" #define OCF_ENGINE_DEBUG_IO_NAME "flush"
#include "engine_debug.h" #include "engine_debug.h"
static void _ocf_engine_ops_complete(struct ocf_request *req, int error) static void _ocf_engine_flush_complete(struct ocf_request *req, int error)
{ {
if (error) if (error)
req->error |= error; req->error |= error;
@ -35,7 +36,7 @@ static void _ocf_engine_ops_complete(struct ocf_request *req, int error)
ocf_req_put(req); ocf_req_put(req);
} }
int ocf_engine_ops(struct ocf_request *req) int ocf_engine_flush(struct ocf_request *req)
{ {
/* Get OCF request - increase reference counter */ /* Get OCF request - increase reference counter */
ocf_req_get(req); ocf_req_get(req);
@ -45,11 +46,11 @@ int ocf_engine_ops(struct ocf_request *req)
/* Submit operation into core device */ /* Submit operation into core device */
ocf_submit_volume_req(&req->core->volume, req, ocf_submit_volume_req(&req->core->volume, req,
_ocf_engine_ops_complete); _ocf_engine_flush_complete);
/* submit flush to cache device */ /* submit flush to cache device */
ocf_submit_cache_flush(req, _ocf_engine_ops_complete); ocf_submit_cache_flush(req, _ocf_engine_flush_complete);
/* Put OCF request - decrease reference counter */ /* Put OCF request - decrease reference counter */
ocf_req_put(req); ocf_req_put(req);

12
src/engine/engine_flush.h Normal file
View File

@ -0,0 +1,12 @@
/*
* Copyright(c) 2012-2021 Intel Corporation
* Copyright(c) 2024 Huawei Technologies
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef __CACHE_ENGINE_FLUSH_H_
#define __CACHE_ENGINE_FLUSH_H_
int ocf_engine_flush(struct ocf_request *req);
#endif /* __CACHE_ENGINE_FLUSH_H_ */

View File

@ -1,11 +0,0 @@
/*
* Copyright(c) 2012-2021 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef __CACHE_ENGINE_OPS_H_
#define __CACHE_ENGINE_OPS_H_
int ocf_engine_ops(struct ocf_request *req);
#endif /* __CACHE_ENGINE_OPS_H_ */

View File

@ -344,7 +344,7 @@ static void ocf_core_volume_submit_flush(struct ocf_io *io)
ocf_io_get(io); ocf_io_get(io);
ocf_engine_hndl_ops_req(req); ocf_engine_hndl_flush_req(req);
} }
static void ocf_core_volume_submit_discard(struct ocf_io *io) static void ocf_core_volume_submit_discard(struct ocf_io *io)