Introduce forward_io_simple

It's intended to be used in a context, where cache is not initialized
and the io_queue is not available yet.

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-10-16 22:13:33 +02:00
committed by Michal Mielewczyk
parent 1f26ceb563
commit 1c2d5bbcf3
7 changed files with 76 additions and 0 deletions

View File

@@ -458,6 +458,17 @@ void ocf_req_forward_volume_discard(struct ocf_request *req,
ocf_volume_forward_discard(volume, token, addr, bytes);
}
void ocf_req_forward_volume_io_simple(struct ocf_request *req,
ocf_volume_t volume, int dir, uint64_t addr, uint64_t bytes)
{
ocf_forward_token_t token = ocf_req_to_cache_forward_token(req);
req->cache_error = 0;
ocf_req_forward_cache_get(req);
ocf_volume_forward_io_simple(volume, token, dir, addr, bytes);
}
void ocf_req_forward_cache_io(struct ocf_request *req, int dir, uint64_t addr,
uint64_t bytes, uint64_t offset)
{
@@ -629,6 +640,13 @@ void ocf_forward_metadata(ocf_volume_t volume, ocf_forward_token_t token,
ocf_volume_forward_metadata(volume, token, dir, addr, bytes, offset);
}
void ocf_forward_io_simple(ocf_volume_t volume, ocf_forward_token_t token,
int dir, uint64_t addr, uint64_t bytes)
{
_ocf_forward_get(token);
ocf_volume_forward_io_simple(volume, token, dir, addr, bytes);
}
void ocf_forward_end(ocf_forward_token_t token, int error)
{
struct ocf_request *req = ocf_req_forward_token_to_req(token);

View File

@@ -564,6 +564,9 @@ void ocf_req_forward_volume_flush(struct ocf_request *req, ocf_volume_t volume);
void ocf_req_forward_volume_discard(struct ocf_request *req,
ocf_volume_t volume, uint64_t addr, uint64_t bytes);
void ocf_req_forward_volume_io_simple(struct ocf_request *req,
ocf_volume_t volume, int dir, uint64_t addr, uint64_t bytes);
void ocf_req_forward_cache_io(struct ocf_request *req, int dir, uint64_t addr,
uint64_t bytes, uint64_t offset);

View File

@@ -398,6 +398,25 @@ void ocf_volume_forward_metadata(ocf_volume_t volume, ocf_forward_token_t token,
dir, addr, bytes, offset);
}
void ocf_volume_forward_io_simple(ocf_volume_t volume,
ocf_forward_token_t token, int dir,
uint64_t addr, uint64_t bytes)
{
if (!volume->type->properties->ops.forward_io_simple) {
ocf_volume_forward_io(volume, token, dir, addr, bytes, 0);
return;
}
if (!volume->opened) {
ocf_forward_end(token, -OCF_ERR_IO);
return;
}
volume->type->properties->ops.forward_io_simple(volume, token,
dir, addr, bytes);
}
int ocf_volume_open(ocf_volume_t volume, void *volume_params)
{
int ret;

View File

@@ -61,6 +61,10 @@ void ocf_volume_forward_write_zeros(ocf_volume_t volume,
void ocf_volume_forward_metadata(ocf_volume_t volume, ocf_forward_token_t token,
int dir, uint64_t addr, uint64_t bytes, uint64_t offset);
void ocf_volume_forward_io_simple(ocf_volume_t volume,
ocf_forward_token_t token, int dir,
uint64_t addr, uint64_t bytes);
static inline void ocf_volume_submit_metadata(struct ocf_io *io)
{
ocf_volume_t volume = ocf_io_get_volume(io);