Re: [PATCH v1] ntfs: preserve the 64-bit FITRIM minimum length

From: Namjae Jeon

Date: Mon Sep 21 2026 - 11:22:50 EST


On Sun, Sep 20, 2026 at 3:32 PM Xuewen Wang <wangxuewen@xxxxxxxxxx> wrote:
>
> The minlen member of struct fstrim_range is a 64-bit byte count, but
> ntfs_ioctl_fitrim() uses max_t(u32, ...) to compare it with the device's
> discard granularity. This truncates the requested minimum length before
> passing it to ntfs_trim_fs().
>
> For example, a minimum length of 4 GiB is reduced to the discard
> granularity, allowing smaller free extents to be discarded. The truncated
> minimum length is also copied back to userspace.
>
> Use max_t(u64, ...) to preserve the requested minimum length. The bitmap
> scan already compares the aligned extent length against range->minlen
> using 64-bit values.
>
> Fixes: 9c87959601e8 ("ntfs: update file operations")
> Signed-off-by: Xuewen Wang <wangxuewen@xxxxxxxxxx>
> Reviewed-by: Baolin Liu <liubaolin@xxxxxxxxxx>
Applied it to #ntfs-next.
Thanks.