diff --git a/src/ocf_request.c b/src/ocf_request.c index f66ad85..01dc4f5 100644 --- a/src/ocf_request.c +++ b/src/ocf_request.c @@ -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, uint64_t bytes, uint64_t offset) { diff --git a/src/ocf_request.h b/src/ocf_request.h index 96c6908..97e6672 100644 --- a/src/ocf_request.h +++ b/src/ocf_request.h @@ -129,7 +129,10 @@ struct ocf_request { struct ocf_io_internal ioi; /*!< 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; env_atomic cache_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); } +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, uint64_t bytes, uint64_t offset);