All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <chao@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] f2fs: skip f2fs_preallocate_blocks() for overwrite case
Date: Tue, 28 Sep 2021 12:08:14 -0700	[thread overview]
Message-ID: <YVNoHudG5c65X85G@google.com> (raw)
In-Reply-To: <20210928151911.11189-1-chao@kernel.org>

On 09/28, Chao Yu wrote:
> In f2fs_file_write_iter(), let's use f2fs_overwrite_io() to
> check whethere it is overwrite case, for such case, we can skip
> f2fs_preallocate_blocks() in order to avoid f2fs_do_map_lock(),
> which may be blocked by checkpoint() potentially.
> 
> Signed-off-by: Chao Yu <chao@kernel.org>
> ---
>  fs/f2fs/file.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index 13deae03df06..51fecb2f4db5 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -4321,6 +4321,10 @@ static ssize_t f2fs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
>  		preallocated = true;
>  		target_size = iocb->ki_pos + iov_iter_count(from);
>  
> +		if (f2fs_overwrite_io(inode, iocb->ki_pos,
> +						iov_iter_count(from)))
> +			goto write;

This calls f2fs_map_blocks() which can be duplicate, if it's not the overwirte
case. Do we have other benefit?

> +
>  		err = f2fs_preallocate_blocks(iocb, from);
>  		if (err) {
>  out_err:
> -- 
> 2.32.0


_______________________________________________
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
Subject: Re: [PATCH] f2fs: skip f2fs_preallocate_blocks() for overwrite case
Date: Tue, 28 Sep 2021 12:08:14 -0700	[thread overview]
Message-ID: <YVNoHudG5c65X85G@google.com> (raw)
In-Reply-To: <20210928151911.11189-1-chao@kernel.org>

On 09/28, Chao Yu wrote:
> In f2fs_file_write_iter(), let's use f2fs_overwrite_io() to
> check whethere it is overwrite case, for such case, we can skip
> f2fs_preallocate_blocks() in order to avoid f2fs_do_map_lock(),
> which may be blocked by checkpoint() potentially.
> 
> Signed-off-by: Chao Yu <chao@kernel.org>
> ---
>  fs/f2fs/file.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index 13deae03df06..51fecb2f4db5 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -4321,6 +4321,10 @@ static ssize_t f2fs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
>  		preallocated = true;
>  		target_size = iocb->ki_pos + iov_iter_count(from);
>  
> +		if (f2fs_overwrite_io(inode, iocb->ki_pos,
> +						iov_iter_count(from)))
> +			goto write;

This calls f2fs_map_blocks() which can be duplicate, if it's not the overwirte
case. Do we have other benefit?

> +
>  		err = f2fs_preallocate_blocks(iocb, from);
>  		if (err) {
>  out_err:
> -- 
> 2.32.0

  reply	other threads:[~2021-09-28 19:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-28 15:19 [f2fs-dev] [PATCH] f2fs: skip f2fs_preallocate_blocks() for overwrite case Chao Yu
2021-09-28 15:19 ` Chao Yu
2021-09-28 19:08 ` Jaegeuk Kim [this message]
2021-09-28 19:08   ` Jaegeuk Kim
2021-09-29  0:05   ` [f2fs-dev] " Chao Yu
2021-09-29  0:05     ` Chao Yu
2021-10-29  2:34     ` [f2fs-dev] " Chao Yu
2021-10-29  2:34       ` Chao Yu
2021-10-29 17:43       ` Jaegeuk Kim
2021-10-29 17:43         ` Jaegeuk Kim
2021-10-30  3:02         ` Chao Yu
2021-10-30  3:02           ` Chao Yu
2021-12-12  3:57           ` Chao Yu
2021-12-12  3:57             ` Chao Yu
2021-12-14 18:56             ` Jaegeuk Kim
2021-12-14 18:56               ` Jaegeuk Kim
2022-02-04  9:10               ` Chao Yu
2022-02-04  9:10                 ` 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=YVNoHudG5c65X85G@google.com \
    --to=jaegeuk@kernel.org \
    --cc=chao@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /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.