[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Nbd] (QEmu-)NBD and discard/TRIM


On Thu, Dec 31, 2015 at 11:30:11AM +0000, Sitsofe Wheeler wrote:
> 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...

Well, since the size of a discard request is expressed by way of the
32-bit "length" field of the nbd request message (which expresses the
length in bytes, not sectors), the maximum size of a discard request can
never be more than 2^32-1 bytes. UINT_MAX seems wrong (except where
unsigned int is a 32-bit integer, obviously).

It is easy to love a country that is famous for chocolate and beer

  -- Barack Obama, speaking in Brussels, Belgium, 2014-03-26

Attachment: signature.asc
Description: PGP signature

Reply to: