Introduce ocf_forward_write_zeros()

This is meant to be used in atomic mode to avoid allocating huge buffers
for zeroing data on drive.

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 12:51:33 +02:00
committed by Michal Mielewczyk
parent c7580a75d7
commit cd544e8ee5
7 changed files with 68 additions and 0 deletions

View File

@@ -285,6 +285,20 @@ void ocf_forward_flush(ocf_volume_t volume, ocf_forward_token_t token);
void ocf_forward_discard(ocf_volume_t volume, ocf_forward_token_t token,
uint64_t addr, uint64_t bytes);
/**
* @brief Forward write_zeros to another subvolume
*
* Forwarding automatically increases forwarded io refcount, so at some
* point additional ocf_forward_end() needs to be called to balance it.
*
* @param[in] volume Volume to which IO is being submitted
* @param[in] token Token representing IO to be forwarded
* @param[in] addr Address to which IO is being submitted
* @param[in] bytes Length of the IO
*/
void ocf_forward_write_zeros(ocf_volume_t volume, ocf_forward_token_t token,
uint64_t addr, uint64_t bytes);
/**
* @brief Increment forwarded io refcount
*

View File

@@ -116,6 +116,19 @@ struct ocf_volume_ops {
void (*forward_discard)(ocf_volume_t volume, ocf_forward_token_t token,
uint64_t addr, uint64_t bytes);
/**
* @brief Froward operation to write zeros to target address (including
* metadata extended LBAs in atomic mode)
*
* @param[in] volume Volume to which IO is being submitted
* @param[in] token Token representing IO to be forwarded
* @param[in] addr Address to which IO is being submitted
* @param[in] bytes Length of the IO
*/
void (*forward_write_zeros)(ocf_volume_t volume,
ocf_forward_token_t token, uint64_t addr,
uint64_t bytes);
/**
* @brief Volume initialization callback, called when volume object
* is being initialized