Re: [PATCH v2 3/3] nbd: correct the maximum value for discard sectors
From: Wouter Verhelst
Date: Thu Aug 08 2024 - 02:55:44 EST
Hi Josef,
On Wed, Aug 07, 2024 at 09:56:25AM -0400, Josef Bacik wrote:
> We use 512 as the "sectors" measurement throughout the block layer, so our limit
> is actually
>
> UINT32_MAX >> 9
>
> since we can only send at most UINT32_MAX as our length. Fix it to be that for
> both patches and you should be good. Thanks,
My first stab actually used UINT32_MAX, but that didn't compile.
I investigated and found that for the kernel, UINT32_MAX and UINT_MAX
are actually the same, but in order for me to be able to use UINT32_MAX
(or U32_MAX, which is also defined to the same value), I would need
extra includes.
So I'll stick with the UINT_MAX >> SECTOR_SHIFT definition that Damien
suggested.
Thanks,
--
w@uter.{be,co.za}
wouter@{grep.be,fosdem.org,debian.org}
I will have a Tin-Actinium-Potassium mixture, thanks.