]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
f2fs: ro: compress: fix to avoid caching unaligned extent
authorChao Yu <chao@kernel.org>
Mon, 26 Feb 2024 07:35:38 +0000 (15:35 +0800)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:20:02 +0000 (18:20 -0400)
commitfa36f5ff74f0daf536647d418cafc0f19d5b116c
treebc843f4c4319f0aec97a161ebbc1b6651b662799
parente690dddae437221b0d524a73b65617597c96b751
f2fs: ro: compress: fix to avoid caching unaligned extent

[ Upstream commit 4b99ecd304290c4ef55666a62c89dfb2dbf0b2cd ]

Mapping info from dump.f2fs:
i_addr[0x2d] cluster flag     [0xfffffffe : 4294967294]
i_addr[0x2e]                  [0x   10428 : 66600]
i_addr[0x2f]                  [0x   10429 : 66601]
i_addr[0x30]                  [0x   1042a : 66602]

f2fs_io fiemap 37 1 /mnt/f2fs/disk-58390c8c.raw

Previsouly, it missed to align fofs and ofs_in_node to cluster_size,
result in adding incorrect read extent cache, fix it.

Before:
f2fs_update_read_extent_tree_range: dev = (253,48), ino = 5, pgofs = 37, len = 4, blkaddr = 66600, c_len = 3

After:
f2fs_update_read_extent_tree_range: dev = (253,48), ino = 5, pgofs = 36, len = 4, blkaddr = 66600, c_len = 3

Fixes: 94afd6d6e525 ("f2fs: extent cache: support unaligned extent")
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/f2fs/compress.c
fs/f2fs/f2fs.h
fs/f2fs/node.c