Re: [PATCH 1/2] nbd: implement the WRITE_ZEROES command
From: Eric Blake
Date: Mon Aug 05 2024 - 08:53:03 EST
On Sat, Aug 03, 2024 at 03:04:30PM GMT, Wouter Verhelst wrote:
> The NBD protocol defines a message for zeroing out a region of an export
>
> Add support to the kernel driver for that message.
>
> Signed-off-by: Wouter Verhelst <w@xxxxxxx>
> ---
> drivers/block/nbd.c | 8 ++++++++
> include/uapi/linux/nbd.h | 5 ++++-
> 2 files changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
> index 5b1811b1ba5f..215e7ea9a3c3 100644
> --- a/drivers/block/nbd.c
> +++ b/drivers/block/nbd.c
> @@ -352,6 +352,8 @@ static int __nbd_set_size(struct nbd_device *nbd, loff_t bytesize,
> }
> if (nbd->config->flags & NBD_FLAG_ROTATIONAL)
> lim.features |= BLK_FEAT_ROTATIONAL;
> + if (nbd->config->flags & NBD_FLAG_SEND_WRITE_ZEROES)
> + lim.max_write_zeroes_sectors = UINT_MAX;
Is that number accurate, when the kernel has not yet been taught to
use 64-bit transactions and can therefore only request a 32-bit byte
length on any one transaction? Would a better limit be
UINT_MAX/blksize?
--
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization: qemu.org | libguestfs.org