* [f2fs-dev] [PATCH] f2fs: fix wrong block mapping for multi-devices
@ 2025-10-07 3:53 Jaegeuk Kim via Linux-f2fs-devel
2025-10-09 3:53 ` Chao Yu via Linux-f2fs-devel
2025-10-10 16:10 ` patchwork-bot+f2fs--- via Linux-f2fs-devel
0 siblings, 2 replies; 3+ messages in thread
From: Jaegeuk Kim via Linux-f2fs-devel @ 2025-10-07 3:53 UTC (permalink / raw)
To: linux-kernel, linux-f2fs-devel; +Cc: Jaegeuk Kim, stable
Assuming the disk layout as below,
disk0: 0 --- 0x00035abfff
disk1: 0x00035ac000 --- 0x00037abfff
disk2: 0x00037ac000 --- 0x00037ebfff
and we want to read data from offset=13568 having len=128 across the block
devices, we can illustrate the block addresses like below.
0 .. 0x00037ac000 ------------------- 0x00037ebfff, 0x00037ec000 -------
| ^ ^ ^
| fofs 0 13568 13568+128
| ------------------------------------------------------
| LBA 0x37e8aa9 0x37ebfa9 0x37ec029
--- map 0x3caa9 0x3ffa9
In this example, we should give the relative map of the target block device
ranging from 0x3caa9 to 0x3ffa9 where the length should be calculated by
0x37ebfff + 1 - 0x37ebfa9.
In the below equation, however, map->m_pblk was supposed to be the original
address instead of the one from the target block address.
- map->m_len = min(map->m_len, dev->end_blk + 1 - map->m_pblk);
Cc: stable@vger.kernel.org
Fixes: 71f2c8206202 ("f2fs: multidevice: support direct IO")
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
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 ef38e62cda8f..775aa4f63aa3 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -1497,8 +1497,8 @@ static bool f2fs_map_blocks_cached(struct inode *inode,
struct f2fs_dev_info *dev = &sbi->devs[bidx];
map->m_bdev = dev->bdev;
- map->m_pblk -= dev->start_blk;
map->m_len = min(map->m_len, dev->end_blk + 1 - map->m_pblk);
+ map->m_pblk -= dev->start_blk;
} else {
map->m_bdev = inode->i_sb->s_bdev;
}
--
2.51.0.710.ga91ca5db03-goog
_______________________________________________
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] 3+ messages in thread* Re: [f2fs-dev] [PATCH] f2fs: fix wrong block mapping for multi-devices
2025-10-07 3:53 [f2fs-dev] [PATCH] f2fs: fix wrong block mapping for multi-devices Jaegeuk Kim via Linux-f2fs-devel
@ 2025-10-09 3:53 ` Chao Yu via Linux-f2fs-devel
2025-10-10 16:10 ` patchwork-bot+f2fs--- via Linux-f2fs-devel
1 sibling, 0 replies; 3+ messages in thread
From: Chao Yu via Linux-f2fs-devel @ 2025-10-09 3:53 UTC (permalink / raw)
To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel; +Cc: stable
On 10/7/2025 11:53 AM, Jaegeuk Kim via Linux-f2fs-devel wrote:
> Assuming the disk layout as below,
>
> disk0: 0 --- 0x00035abfff
> disk1: 0x00035ac000 --- 0x00037abfff
> disk2: 0x00037ac000 --- 0x00037ebfff
>
> and we want to read data from offset=13568 having len=128 across the block
> devices, we can illustrate the block addresses like below.
>
> 0 .. 0x00037ac000 ------------------- 0x00037ebfff, 0x00037ec000 -------
> | ^ ^ ^
> | fofs 0 13568 13568+128
> | ------------------------------------------------------
> | LBA 0x37e8aa9 0x37ebfa9 0x37ec029
> --- map 0x3caa9 0x3ffa9
>
> In this example, we should give the relative map of the target block device
> ranging from 0x3caa9 to 0x3ffa9 where the length should be calculated by
> 0x37ebfff + 1 - 0x37ebfa9.
>
> In the below equation, however, map->m_pblk was supposed to be the original
> address instead of the one from the target block address.
>
> - map->m_len = min(map->m_len, dev->end_blk + 1 - map->m_pblk);
>
> Cc: stable@vger.kernel.org
> Fixes: 71f2c8206202 ("f2fs: multidevice: support direct IO")
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Looks good to me, thanks for the fix!
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
_______________________________________________
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] 3+ messages in thread* Re: [f2fs-dev] [PATCH] f2fs: fix wrong block mapping for multi-devices
2025-10-07 3:53 [f2fs-dev] [PATCH] f2fs: fix wrong block mapping for multi-devices Jaegeuk Kim via Linux-f2fs-devel
2025-10-09 3:53 ` Chao Yu via Linux-f2fs-devel
@ 2025-10-10 16:10 ` patchwork-bot+f2fs--- via Linux-f2fs-devel
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+f2fs--- via Linux-f2fs-devel @ 2025-10-10 16:10 UTC (permalink / raw)
To: Jaegeuk Kim; +Cc: linux-kernel, stable, linux-f2fs-devel
Hello:
This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:
On Tue, 7 Oct 2025 03:53:43 +0000 you wrote:
> Assuming the disk layout as below,
>
> disk0: 0 --- 0x00035abfff
> disk1: 0x00035ac000 --- 0x00037abfff
> disk2: 0x00037ac000 --- 0x00037ebfff
>
> and we want to read data from offset=13568 having len=128 across the block
> devices, we can illustrate the block addresses like below.
>
> [...]
Here is the summary with links:
- [f2fs-dev] f2fs: fix wrong block mapping for multi-devices
https://git.kernel.org/jaegeuk/f2fs/c/7d9fdb3c9e5b
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] 3+ messages in thread
end of thread, other threads:[~2025-10-10 16:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-07 3:53 [f2fs-dev] [PATCH] f2fs: fix wrong block mapping for multi-devices Jaegeuk Kim via Linux-f2fs-devel
2025-10-09 3:53 ` Chao Yu via Linux-f2fs-devel
2025-10-10 16:10 ` 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).