All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaegeuk Kim via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: Chao Yu <chao@kernel.org>
Cc: kernel test robot <oliver.sang@intel.com>,
	linux-kernel@vger.kernel.org, Cyril Hrubis <chrubis@suse.cz>,
	linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] f2fs: fix to map blocks correctly for direct read
Date: Fri, 1 Nov 2024 21:06:25 +0000	[thread overview]
Message-ID: <ZyVC0R8JYwMZXM9u@google.com> (raw)
In-Reply-To: <fede8a9b-8532-4d63-a4db-b52ed088d6f8@kernel.org>

On 11/01, Chao Yu wrote:
> On 2024/11/1 9:22, Jaegeuk Kim wrote:
> > On 10/31, Chao Yu wrote:
> > > f2fs_map_blocks() supports to map continuous holes or preallocated
> > > address, we should avoid setting F2FS_MAP_MAPPED for these cases
> > > only, otherwise, it may fail f2fs_iomap_begin(), and make direct
> > > write fallbacking to use buffered IO and flush, result in performance
> > > regression.
> > 
> > Is this fixing direct write or read?
> 
> Direct write.

I was confising the patch subject is saying direct read.

> 
> > 
> > > 
> > > Fixes: 9f0f6bf42714 ("f2fs: support to map continuous holes or preallocated address")
> > > Reported-by: kernel test robot <oliver.sang@intel.com>
> > > Closes: https://lore.kernel.org/oe-lkp/202409122103.e45aa13b-oliver.sang@intel.com
> > > Cc: Cyril Hrubis <chrubis@suse.cz>
> > > Signed-off-by: Chao Yu <chao@kernel.org>
> > > ---
> > >   fs/f2fs/data.c | 7 ++++++-
> > >   1 file changed, 6 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> > > index 306b86b0595d..38b85160c6bd 100644
> > > --- a/fs/f2fs/data.c
> > > +++ b/fs/f2fs/data.c
> > > @@ -1676,7 +1676,12 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, int flag)
> > >   		/* reserved delalloc block should be mapped for fiemap. */
> > >   		if (blkaddr == NEW_ADDR)
> > >   			map->m_flags |= F2FS_MAP_DELALLOC;
> > > -		if (flag != F2FS_GET_BLOCK_DIO || !is_hole)
> > > +		/*
> > > +		 * f2fs_map_blocks() supports to map continuous holes or
> > > +		 * preallocated address, don't set F2FS_MAP_MAPPED for these
> > > +		 * cases only.
> > > +		 */
> > > +		if (flag != F2FS_GET_BLOCK_DIO || map->m_may_create || !is_hole)
> > 
> > So, this is adding map->m_may_create, which is for writes?
> 
> map->m_may_create is added for write path, w/o this condition, f2fs_map_blocks()
> may missed to tag F2FS_MAP_MAPPED, result in that f2fs_iomap_begin() will return
> -ENOTBLK.

Is that something like this?

/* DIO READ and hole case, should not map the blocks. */
if (!(flag == F2FS_GET_BLOCK_DIO && is_hole && !map->m_may_create))

> 
> Am I missing someting?
> 
> Thanks,
> 
> > 
> > >   			map->m_flags |= F2FS_MAP_MAPPED;
> > >   		map->m_pblk = blkaddr;
> > > -- 
> > > 2.40.1


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

WARNING: multiple messages have this Message-ID (diff)
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <chao@kernel.org>
Cc: linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org,
	kernel test robot <oliver.sang@intel.com>,
	Cyril Hrubis <chrubis@suse.cz>
Subject: Re: [PATCH] f2fs: fix to map blocks correctly for direct read
Date: Fri, 1 Nov 2024 21:06:25 +0000	[thread overview]
Message-ID: <ZyVC0R8JYwMZXM9u@google.com> (raw)
In-Reply-To: <fede8a9b-8532-4d63-a4db-b52ed088d6f8@kernel.org>

On 11/01, Chao Yu wrote:
> On 2024/11/1 9:22, Jaegeuk Kim wrote:
> > On 10/31, Chao Yu wrote:
> > > f2fs_map_blocks() supports to map continuous holes or preallocated
> > > address, we should avoid setting F2FS_MAP_MAPPED for these cases
> > > only, otherwise, it may fail f2fs_iomap_begin(), and make direct
> > > write fallbacking to use buffered IO and flush, result in performance
> > > regression.
> > 
> > Is this fixing direct write or read?
> 
> Direct write.

I was confising the patch subject is saying direct read.

> 
> > 
> > > 
> > > Fixes: 9f0f6bf42714 ("f2fs: support to map continuous holes or preallocated address")
> > > Reported-by: kernel test robot <oliver.sang@intel.com>
> > > Closes: https://lore.kernel.org/oe-lkp/202409122103.e45aa13b-oliver.sang@intel.com
> > > Cc: Cyril Hrubis <chrubis@suse.cz>
> > > Signed-off-by: Chao Yu <chao@kernel.org>
> > > ---
> > >   fs/f2fs/data.c | 7 ++++++-
> > >   1 file changed, 6 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> > > index 306b86b0595d..38b85160c6bd 100644
> > > --- a/fs/f2fs/data.c
> > > +++ b/fs/f2fs/data.c
> > > @@ -1676,7 +1676,12 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, int flag)
> > >   		/* reserved delalloc block should be mapped for fiemap. */
> > >   		if (blkaddr == NEW_ADDR)
> > >   			map->m_flags |= F2FS_MAP_DELALLOC;
> > > -		if (flag != F2FS_GET_BLOCK_DIO || !is_hole)
> > > +		/*
> > > +		 * f2fs_map_blocks() supports to map continuous holes or
> > > +		 * preallocated address, don't set F2FS_MAP_MAPPED for these
> > > +		 * cases only.
> > > +		 */
> > > +		if (flag != F2FS_GET_BLOCK_DIO || map->m_may_create || !is_hole)
> > 
> > So, this is adding map->m_may_create, which is for writes?
> 
> map->m_may_create is added for write path, w/o this condition, f2fs_map_blocks()
> may missed to tag F2FS_MAP_MAPPED, result in that f2fs_iomap_begin() will return
> -ENOTBLK.

Is that something like this?

/* DIO READ and hole case, should not map the blocks. */
if (!(flag == F2FS_GET_BLOCK_DIO && is_hole && !map->m_may_create))

> 
> Am I missing someting?
> 
> Thanks,
> 
> > 
> > >   			map->m_flags |= F2FS_MAP_MAPPED;
> > >   		map->m_pblk = blkaddr;
> > > -- 
> > > 2.40.1

  reply	other threads:[~2024-11-01 21:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-31 10:22 [f2fs-dev] [PATCH] f2fs: fix to map blocks correctly for direct read Chao Yu via Linux-f2fs-devel
2024-10-31 10:22 ` Chao Yu
2024-11-01  1:22 ` [f2fs-dev] " Jaegeuk Kim via Linux-f2fs-devel
2024-11-01  1:22   ` Jaegeuk Kim
2024-11-01  1:32   ` [f2fs-dev] " Chao Yu via Linux-f2fs-devel
2024-11-01  1:32     ` Chao Yu
2024-11-01 21:06     ` Jaegeuk Kim via Linux-f2fs-devel [this message]
2024-11-01 21:06       ` Jaegeuk Kim
2024-11-02  0:25       ` [f2fs-dev] " Chao Yu via Linux-f2fs-devel
2024-11-02  0:25         ` Chao Yu

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=ZyVC0R8JYwMZXM9u@google.com \
    --to=linux-f2fs-devel@lists.sourceforge.net \
    --cc=chao@kernel.org \
    --cc=chrubis@suse.cz \
    --cc=jaegeuk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oliver.sang@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.