Support set_data() with offset > 0 for core
Signed-off-by: Roel Apfelbaum <roel.apfelbaum@huawei.com> Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
This commit is contained in:
committed by
Michal Mielewczyk
parent
eb44557aed
commit
73387c8f26
@@ -51,7 +51,7 @@ static int _ocf_discard_core(struct ocf_request *req)
|
||||
}
|
||||
|
||||
ocf_io_set_cmpl(io, req, NULL, _ocf_discard_core_complete);
|
||||
err = ocf_io_set_data(io, req->data, 0);
|
||||
err = ocf_io_set_data(io, req->data, req->offset);
|
||||
if (err) {
|
||||
_ocf_discard_core_complete(io, err);
|
||||
return err;
|
||||
|
||||
@@ -438,11 +438,12 @@ static int ocf_core_io_set_data(struct ocf_io *io,
|
||||
|
||||
OCF_CHECK_NULL(io);
|
||||
|
||||
if (!data || offset)
|
||||
if (!data)
|
||||
return -OCF_ERR_INVAL;
|
||||
|
||||
req = ocf_io_to_req(io);
|
||||
req->data = data;
|
||||
req->offset = offset;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -186,6 +186,9 @@ struct ocf_request {
|
||||
uint32_t alloc_core_line_count;
|
||||
/*! Number of core lines at time of request allocation */
|
||||
|
||||
uint32_t offset;
|
||||
/*!< Offset into request data*/
|
||||
|
||||
int error;
|
||||
/*!< This filed indicates an error for OCF request */
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright(c) 2012-2022 Intel Corporation
|
||||
* Copyright(c) 2024 Huawei Technologies
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
@@ -273,7 +274,7 @@ void ocf_submit_cache_reqs(struct ocf_cache *cache,
|
||||
|
||||
ocf_io_set_cmpl(io, req, callback, ocf_submit_volume_req_cmpl);
|
||||
|
||||
err = ocf_io_set_data(io, req->data, offset);
|
||||
err = ocf_io_set_data(io, req->data, req->offset + offset);
|
||||
if (err) {
|
||||
ocf_io_put(io);
|
||||
callback(req, err);
|
||||
@@ -322,7 +323,8 @@ void ocf_submit_cache_reqs(struct ocf_cache *cache,
|
||||
|
||||
ocf_io_set_cmpl(io, req, callback, ocf_submit_volume_req_cmpl);
|
||||
|
||||
err = ocf_io_set_data(io, req->data, offset + total_bytes);
|
||||
err = ocf_io_set_data(io, req->data,
|
||||
req->offset + offset + total_bytes);
|
||||
if (err) {
|
||||
ocf_io_put(io);
|
||||
/* Finish all IOs which left with ERROR */
|
||||
@@ -359,7 +361,7 @@ void ocf_submit_volume_req(ocf_volume_t volume, struct ocf_request *req,
|
||||
}
|
||||
|
||||
ocf_io_set_cmpl(io, req, callback, ocf_submit_volume_req_cmpl);
|
||||
err = ocf_io_set_data(io, req->data, 0);
|
||||
err = ocf_io_set_data(io, req->data, req->offset);
|
||||
if (err) {
|
||||
ocf_io_put(io);
|
||||
callback(req, err);
|
||||
|
||||
Reference in New Issue
Block a user