summaryrefslogtreecommitdiff
path: root/tools/lib/python
diff options
context:
space:
mode:
authorZhan Xusheng <zhanxusheng1024@gmail.com>2026-10-05 23:49:54 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2026-10-13 18:45:04 +0000
commit92154fe28c3701bebf75176dc5522bec62519a8f (patch)
tree218eed5d4706422324aca218a01f7d864178e2c8 /tools/lib/python
parenta45c9a0055f5ccff0c5c546e0478604b990f23ab (diff)
f2fs: fix defragment writeback range truncation on 32-bit
f2fs_defragment_range() flushes the range it is about to defragment: filemap_write_and_wait_range(inode->i_mapping, pg_start << PAGE_SHIFT, (pg_end << PAGE_SHIFT) - 1); pg_start and pg_end are pgoff_t, 32 bits on 32-bit kernels, so both shifts are evaluated in 32 bits and truncated before they are widened to the loff_t parameters. pg_end is only capped by the file's page count, so for a file larger than 4 GiB the shift wraps. For a 5 GiB file pg_end is 1310720 and the range collapses from [0, 5 GiB) to [0, 1 GiB), leaving the rest of the dirty pages unwritten before the blocks are moved. For 8 GiB the shift yields 0, the minus one makes it (loff_t)-1, and the range becomes [0, LLONG_MAX]. The matching call in f2fs_collapse_range() already casts: filemap_write_and_wait_range(inode->i_mapping, (loff_t)index << PAGE_SHIFT, ((loff_t)pg_end << PAGE_SHIFT) - 1); Do the same here. On i386 the shift changes from "shl $0xc,%ecx" to "shld", i.e. from a 32-bit shift to a double-precision one. Cc: stable@kernel.org Fixes: d323d005ac4a ("f2fs: support file defragment") Signed-off-by: Zhan Xusheng <zhanxusheng@xiaomi.com> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions