Modify engines to use forward API
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com> Signed-off-by: Rafal Stefanowski <rafal.stefanowski@huawei.com> Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
This commit is contained in:
committed by
Michal Mielewczyk
parent
e667c10b4a
commit
1ed707361f
@@ -8,10 +8,10 @@
|
||||
#include "../ocf_cache_priv.h"
|
||||
#include "engine_wi.h"
|
||||
#include "engine_common.h"
|
||||
#include "engine_io.h"
|
||||
#include "../concurrency/ocf_concurrency.h"
|
||||
#include "../ocf_request.h"
|
||||
#include "../utils/utils_cache_line.h"
|
||||
#include "../utils/utils_io.h"
|
||||
#include "../metadata/metadata.h"
|
||||
|
||||
#define OCF_ENGINE_DEBUG_IO_NAME "wi"
|
||||
@@ -22,7 +22,7 @@ static int _ocf_write_wi_next_pass(struct ocf_request *req)
|
||||
ocf_req_unlock_wr(ocf_cache_line_concurrency(req->cache), req);
|
||||
|
||||
if (req->wi_second_pass) {
|
||||
req->complete(req, req->error);
|
||||
req->complete(req, 0);
|
||||
ocf_req_put(req);
|
||||
|
||||
return 0;
|
||||
@@ -48,25 +48,19 @@ static void _ocf_write_wi_io_flush_metadata(struct ocf_request *req, int error)
|
||||
{
|
||||
if (error) {
|
||||
ocf_core_stats_cache_error_update(req->core, OCF_WRITE);
|
||||
req->error |= error;
|
||||
ocf_engine_error(req, true, "Failed to write data to cache");
|
||||
}
|
||||
|
||||
if (env_atomic_dec_return(&req->req_remaining))
|
||||
return;
|
||||
|
||||
if (!req->error && !req->wi_second_pass && ocf_engine_is_miss(req)) {
|
||||
if (!error && !req->wi_second_pass && ocf_engine_is_miss(req)) {
|
||||
/* need another pass */
|
||||
ocf_queue_push_req_cb(req, _ocf_write_wi_next_pass,
|
||||
OCF_QUEUE_ALLOW_SYNC | OCF_QUEUE_PRIO_HIGH);
|
||||
return;
|
||||
}
|
||||
|
||||
if (req->error)
|
||||
ocf_engine_error(req, true, "Failed to write data to cache");
|
||||
|
||||
ocf_req_unlock_wr(ocf_cache_line_concurrency(req->cache), req);
|
||||
|
||||
req->complete(req, req->error);
|
||||
req->complete(req, error);
|
||||
|
||||
ocf_req_put(req);
|
||||
}
|
||||
@@ -105,20 +99,14 @@ static int ocf_write_wi_update_and_flush_metadata(struct ocf_request *req)
|
||||
|
||||
static void _ocf_write_wi_core_complete(struct ocf_request *req, int error)
|
||||
{
|
||||
if (error) {
|
||||
req->error = error;
|
||||
ocf_core_stats_core_error_update(req->core, OCF_WRITE);
|
||||
}
|
||||
|
||||
if (env_atomic_dec_return(&req->req_remaining))
|
||||
return;
|
||||
|
||||
OCF_DEBUG_RQ(req, "Completion");
|
||||
|
||||
if (req->error) {
|
||||
if (error) {
|
||||
ocf_core_stats_core_error_update(req->core, OCF_WRITE);
|
||||
|
||||
ocf_req_unlock_wr(ocf_cache_line_concurrency(req->cache), req);
|
||||
|
||||
req->complete(req, req->error);
|
||||
req->complete(req, error);
|
||||
|
||||
ocf_req_put(req);
|
||||
} else {
|
||||
@@ -146,13 +134,10 @@ static int _ocf_write_wi_core_write(struct ocf_request *req)
|
||||
return 0;
|
||||
}
|
||||
|
||||
env_atomic_set(&req->req_remaining, 1); /* One core IO */
|
||||
|
||||
OCF_DEBUG_RQ(req, "Submit");
|
||||
|
||||
/* Submit write IO to the core */
|
||||
ocf_submit_volume_req(&req->core->volume, req,
|
||||
_ocf_write_wi_core_complete);
|
||||
ocf_engine_forward_core_io_req(req, _ocf_write_wi_core_complete);
|
||||
|
||||
/* Update statistics */
|
||||
ocf_engine_update_block_stats(req);
|
||||
|
||||
Reference in New Issue
Block a user