Re: [PATCH] ntfs: compute bi_sector in 512-byte units
From: Hyunchul Lee
Date: Mon Aug 24 2026 - 21:29:16 EST
2026년 8월 23일 (일) 오후 4:13, Dennis Tighe <dennis.tighe@xxxxxxxxx>님이 작성:
>
> 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>
Looks good to me.
Reviewed-by: Hyunchul Lee <hyc.lee@xxxxxxxxx>