Re: [Nbd] (QEmu-)NBD and discard/TRIM
On 31/12/2015 12:30, Sitsofe Wheeler wrote:
> Further, re-running qemu-nbd with -v says this:
> nbd.c:nbd_co_receive_request():L1232: len (536870912) is larger than max len (33554432)
> which comes from https://github.com/qemu/qemu/blob/v2.5.0/nbd.c#L1230 :
> if (request->len > NBD_MAX_BUFFER_SIZE) {
> LOG("len (%u) is larger than max len (%u)",
> request->len, NBD_MAX_BUFFER_SIZE);
> rc = -EINVAL;
> goto out;
> }
> NBD_MAX_BUFFER_SIZE is defined in
> https://github.com/qemu/qemu/blob/v2.5.0/include/block/nbd.h#L73 :
> /* Maximum size of a single READ/WRITE data buffer */
> #define NBD_MAX_BUFFER_SIZE (32 * 1024 * 1024)
>
> In this particular case the real request is probably far smaller than it
> looks because we aren't individual data for each LBA...
>
> If max discard sectors has to be hard coded on NBD clients, perhaps the
> kernel code should be changed to always limit the size to 0xFFFF rather
> than using UINT_MAX (this will stop it varying by platform)?
> Alternatively a more flexible solution might be to allow the NBD server
> to tell the NBD client the maximum number of discard sectors it can pass
> à la SCSI...
This is a QEMU bug. The check is not needed for discards.
Paolo
Reply to: