Introduce ocf_req_forward_volume_*()

Those are meant to be used in context where no cache nor queue is
available (typically at very early stage of initialization). We reuse
cache_forward* callback and counter, because they will not be used
in this context anyway.

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-13 08:13:15 +02:00 committed by Michal Mielewczyk
parent 07abdf5d8b
commit 54f75ba492
2 changed files with 38 additions and 1 deletions

View File

@ -432,6 +432,32 @@ void ocf_req_hash(struct ocf_request *req)
} }
} }
void ocf_req_forward_volume_io(struct ocf_request *req, ocf_volume_t volume,
int dir, uint64_t addr, uint64_t bytes, uint64_t offset)
{
ocf_forward_token_t token = ocf_req_to_cache_forward_token(req);
ocf_req_forward_cache_get(req);
ocf_volume_forward_io(volume, token, dir, addr, bytes, offset);
}
void ocf_req_forward_volume_flush(struct ocf_request *req, ocf_volume_t volume)
{
ocf_forward_token_t token = ocf_req_to_cache_forward_token(req);
ocf_req_forward_cache_get(req);
ocf_volume_forward_flush(volume, token);
}
void ocf_req_forward_volume_discard(struct ocf_request *req,
ocf_volume_t volume, uint64_t addr, uint64_t bytes)
{
ocf_forward_token_t token = ocf_req_to_cache_forward_token(req);
ocf_req_forward_cache_get(req);
ocf_volume_forward_discard(volume, token, addr, bytes);
}
void ocf_req_forward_cache_io(struct ocf_request *req, int dir, uint64_t addr, void ocf_req_forward_cache_io(struct ocf_request *req, int dir, uint64_t addr,
uint64_t bytes, uint64_t offset) uint64_t bytes, uint64_t offset)
{ {

View File

@ -129,7 +129,10 @@ struct ocf_request {
struct ocf_io_internal ioi; struct ocf_io_internal ioi;
/*!< OCF IO associated with request */ /*!< OCF IO associated with request */
ocf_req_end_t cache_forward_end; union {
ocf_req_end_t cache_forward_end;
ocf_req_end_t volume_forward_end;
};
ocf_req_end_t core_forward_end; ocf_req_end_t core_forward_end;
env_atomic cache_remaining; env_atomic cache_remaining;
env_atomic core_remaining; env_atomic core_remaining;
@ -553,6 +556,14 @@ static inline struct ocf_request *ocf_req_forward_token_to_req(ocf_forward_token
return (struct ocf_request *)(token & ~1); return (struct ocf_request *)(token & ~1);
} }
void ocf_req_forward_volume_io(struct ocf_request *req, ocf_volume_t volume,
int dir, uint64_t addr, uint64_t bytes, uint64_t offset);
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_cache_io(struct ocf_request *req, int dir, uint64_t addr, void ocf_req_forward_cache_io(struct ocf_request *req, int dir, uint64_t addr,
uint64_t bytes, uint64_t offset); uint64_t bytes, uint64_t offset);