linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH v2] f2fs: fix to update map->m_next_extent correctly in f2fs_map_blocks()
@ 2025-09-12  8:12 Chao Yu via Linux-f2fs-devel
  2025-09-29 22:30 ` patchwork-bot+f2fs--- via Linux-f2fs-devel
  0 siblings, 1 reply; 2+ messages in thread
From: Chao Yu via Linux-f2fs-devel @ 2025-09-12  8:12 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-kernel, linux-f2fs-devel

Script to reproduce:
mkfs.f2fs -O extra_attr,compression /dev/vdb -f
mount /dev/vdb /mnt/f2fs -o mode=lfs,noextent_cache
cd /mnt/f2fs
f2fs_io write 1 0 1024 rand dsync testfile
xfs_io testfile -c "fsync"
f2fs_io write 1 0 512 rand dsync testfile
xfs_io testfile -c "fsync"
cd /
umount /mnt/f2fs
mount /dev/vdb /mnt/f2fs
f2fs_io precache_extents /mnt/f2fs/testfile
umount /mnt/f2fs

Tracepoint output:
f2fs_update_read_extent_tree_range: dev = (253,16), ino = 4, pgofs = 0, len = 512, blkaddr = 1055744, c_len = 0
f2fs_update_read_extent_tree_range: dev = (253,16), ino = 4, pgofs = 513, len = 351, blkaddr = 17921, c_len = 0
f2fs_update_read_extent_tree_range: dev = (253,16), ino = 4, pgofs = 864, len = 160, blkaddr = 18272, c_len = 0

During precache_extents, there is off-by-one issue, we should update
map->m_next_extent to pgofs rather than pgofs + 1, if last blkaddr is
valid and not contiguous to previous extent.

Fixes: c4020b2da4c9 ("f2fs: support F2FS_IOC_PRECACHE_EXTENTS")
Signed-off-by: Chao Yu <chao@kernel.org>
---
v2:
- clean up codes
 fs/f2fs/data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 6bb03add93fe..d747850e765f 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -1782,7 +1782,7 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, int flag)
 				map->m_len - ofs);
 		}
 		if (map->m_next_extent)
-			*map->m_next_extent = pgofs + 1;
+			*map->m_next_extent = is_hole ? pgofs + 1 : pgofs;
 	}
 	f2fs_put_dnode(&dn);
 unlock_out:
-- 
2.40.1



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [f2fs-dev] [PATCH v2] f2fs: fix to update map->m_next_extent correctly in f2fs_map_blocks()
  2025-09-12  8:12 [f2fs-dev] [PATCH v2] f2fs: fix to update map->m_next_extent correctly in f2fs_map_blocks() Chao Yu via Linux-f2fs-devel
@ 2025-09-29 22:30 ` patchwork-bot+f2fs--- via Linux-f2fs-devel
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+f2fs--- via Linux-f2fs-devel @ 2025-09-29 22:30 UTC (permalink / raw)
  To: Chao Yu; +Cc: jaegeuk, linux-kernel, linux-f2fs-devel

Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:

On Fri, 12 Sep 2025 16:12:50 +0800 you wrote:
> Script to reproduce:
> mkfs.f2fs -O extra_attr,compression /dev/vdb -f
> mount /dev/vdb /mnt/f2fs -o mode=lfs,noextent_cache
> cd /mnt/f2fs
> f2fs_io write 1 0 1024 rand dsync testfile
> xfs_io testfile -c "fsync"
> f2fs_io write 1 0 512 rand dsync testfile
> xfs_io testfile -c "fsync"
> cd /
> umount /mnt/f2fs
> mount /dev/vdb /mnt/f2fs
> f2fs_io precache_extents /mnt/f2fs/testfile
> umount /mnt/f2fs
> 
> [...]

Here is the summary with links:
  - [f2fs-dev,v2] f2fs: fix to update map->m_next_extent correctly in f2fs_map_blocks()
    https://git.kernel.org/jaegeuk/f2fs/c/869833f54e83

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-09-29 22:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-12  8:12 [f2fs-dev] [PATCH v2] f2fs: fix to update map->m_next_extent correctly in f2fs_map_blocks() Chao Yu via Linux-f2fs-devel
2025-09-29 22:30 ` patchwork-bot+f2fs--- via Linux-f2fs-devel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).