From: Chao Yu <chao@kernel.org>
To: Wu Bo <bo.wu@vivo.com>, Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Wu Bo <wubo.oduw@gmail.com>,
linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] f2fs: fix 0 addr of multi devices when dio mapping
Date: Fri, 29 Mar 2024 18:27:22 +0800 [thread overview]
Message-ID: <9172f17e-deb4-4219-b917-330cdffa5a81@kernel.org> (raw)
In-Reply-To: <20240329065508.2398202-1-bo.wu@vivo.com>
On 2024/3/29 14:55, Wu Bo wrote:
> Consider of a f2fs system with 2 devices:
> Info: Device[0] : /dev/block/dm-46 blkaddr = 0--3fffff
> Info: Device[1] : /dev/block/dm-47 blkaddr = 400000--67fffff
>
> f2fs_map_blocks will return logical addr of fs when doing buffered io:
> f2fs_map_blocks: dev = (254,46), ino = 40020, file offset = 462865, start blkaddr = 0x400000
>
> While dio mapping will return the addr of device:
> f2fs_map_blocks: dev = (254,47), ino = 40020, file offset = 462865, start blkaddr = 0x0
>
> So the addr=0 is valid when the map.m_bdev is not s_bdev.
Thanks for catching this, there is already a formal patch as below link:
https://lore.kernel.org/linux-f2fs-devel/20240327074223.2216487-1-chao@kernel.org
Thanks,
>
> Fixes: 8d3c1fa3fa5e ("f2fs: don't rely on F2FS_MAP_* in f2fs_iomap_begin")
> Signed-off-by: Wu Bo <bo.wu@vivo.com>
> ---
> fs/f2fs/data.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index d9494b5fc7c1..dca3628932c7 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -4185,7 +4185,8 @@ static int f2fs_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
> if (WARN_ON_ONCE(map.m_pblk == COMPRESS_ADDR))
> return -EINVAL;
>
> - if (map.m_pblk != NULL_ADDR) {
> + if (map.m_pblk != NULL_ADDR ||
> + (map.m_multidev_dio && map.m_bdev != inode->i_sb->s_bdev)) {
> iomap->length = blks_to_bytes(inode, map.m_len);
> iomap->type = IOMAP_MAPPED;
> iomap->flags |= IOMAP_F_MERGED;
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
prev parent reply other threads:[~2024-03-29 10:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-29 6:55 [f2fs-dev] [PATCH] f2fs: fix 0 addr of multi devices when dio mapping Wu Bo via Linux-f2fs-devel
2024-03-29 10:27 ` Chao Yu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9172f17e-deb4-4219-b917-330cdffa5a81@kernel.org \
--to=chao@kernel.org \
--cc=bo.wu@vivo.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=wubo.oduw@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).