On Mon, Aug 05, 2024 at 07:52:42AM -0500, Eric Blake wrote: > 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? Thanks, good catch. I copied the logic from the handling of the TRIM command (i.e., the discard logic), which has the same flawed UINT_MAX behavior. I will fix this in v2 and add a fix for the discard code. -- w@uter.{be,co.za} wouter@{grep.be,fosdem.org,debian.org} I will have a Tin-Actinium-Potassium mixture, thanks.