Re: [PATCH] f2fs: preserve 64-bit FITRIM minimum lengths

From: Chao Yu

Date: Sun Nov 01 2026 - 21:12:06 EST


On 11/1/26 07:39, Hungyu Lin wrote:
The FITRIM minimum length is a 64-bit byte count. f2fs_ioc_fitrim()
narrows it to unsigned int while applying the device granularity, so a
minimum of 4 GiB becomes the device granularity. fstrim can consequently
discard free extents smaller than the requested minimum.

Use u64 when applying the device granularity. The checkpoint's
trim_minlen already retains the 64-bit block count; also widen the
discard policy field and its initializer argument so larger minimums
are not truncated when passed to the issue and wait paths.


Cc: stable@xxxxxxxxxxxxxxx

Fixes: 4b2fecc84655 ("f2fs: introduce FITRIM in f2fs_ioctl")
Signed-off-by: Hungyu Lin <dennylin0707@xxxxxxxxx>

Reviewed-by: Chao Yu <chao@xxxxxxxxxx>

Thanks,