Re: [PATCH] ntfs: compute bi_sector in 512-byte units
From: Namjae Jeon
Date: Thu Aug 27 2026 - 09:05:20 EST
On Sun, Aug 23, 2026 at 4:13 PM Dennis Tighe <dennis.tighe@xxxxxxxxx> wrote:
>
> bi_sector counts in 512 byte sectors and not in multiples of the
> volume's sector size. Under "normal" circumstances (with 512 byte
> sectors in NTFS) the current code works as is; however, when we have
> a 4k sector size on the volume the current usage of NTFS_B_TO_SECTOR()
> and ntfs_bytes_to_sector() end up converting to the number of 4k
> sectors after mount.
>
> Reads work today on 4k volumes as bdev-io.c as performing the shift
> correctly inline. With writes, we end up with significant silent disk
> corruption on these volumes.
>
> This fixes changes to use the new ntfs_bytes_to_bio_sector() function
> everywhere we're performing this calculation (including the existing
> read path). For the change in inode.c it removes a dead code block
> rather than updating.
>
> Fixes: 40796051991d ("ntfs: update in-memory, on-disk structures and headers")
> Assisted-by: Claude:claude-opus-5
> Signed-off-by: Dennis Tighe <dennis.tighe@xxxxxxxxx>
Applied it to #ntfs-for-next.
Thanks!