All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <chao@kernel.org>
Cc: Eric Biggers <ebiggers@google.com>,
	linux-kernel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH 4/6] f2fs: don't set FI_PREALLOCATED_ALL for partial write
Date: Mon, 11 Dec 2023 14:08:41 -0800	[thread overview]
Message-ID: <ZXeIabjxfk8tN10r@google.com> (raw)
In-Reply-To: <20231210113547.3412782-4-chao@kernel.org>

On 12/10, Chao Yu wrote:
> In f2fs_preallocate_blocks(), if it is partial write in 4KB, it's not
> necessary to call f2fs_map_blocks() and set FI_PREALLOCATED_ALL flag.
> 
> Cc: Eric Biggers <ebiggers@google.com>
> Signed-off-by: Chao Yu <chao@kernel.org>
> ---
>  fs/f2fs/file.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index 5c2f99ada6be..1a3c29a9a6a0 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -4561,13 +4561,14 @@ static int f2fs_preallocate_blocks(struct kiocb *iocb, struct iov_iter *iter,
>  			return ret;
>  	}
>  
> -	/* Do not preallocate blocks that will be written partially in 4KB. */
>  	map.m_lblk = F2FS_BLK_ALIGN(pos);
>  	map.m_len = F2FS_BYTES_TO_BLK(pos + count);
> -	if (map.m_len > map.m_lblk)
> -		map.m_len -= map.m_lblk;
> -	else

		return 0;

We just need the above?

> -		map.m_len = 0;
> +
> +	/* Do not preallocate blocks that will be written partially in 4KB. */
> +	if (map.m_len <= map.m_lblk)
> +		return 0;
> +
> +	map.m_len -= map.m_lblk;
>  	map.m_may_create = true;
>  	if (dio) {
>  		map.m_seg_type = f2fs_rw_hint_to_seg_type(inode->i_write_hint);
> -- 
> 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, Eric Biggers <ebiggers@google.com>
Subject: Re: [PATCH 4/6] f2fs: don't set FI_PREALLOCATED_ALL for partial write
Date: Mon, 11 Dec 2023 14:08:41 -0800	[thread overview]
Message-ID: <ZXeIabjxfk8tN10r@google.com> (raw)
In-Reply-To: <20231210113547.3412782-4-chao@kernel.org>

On 12/10, Chao Yu wrote:
> In f2fs_preallocate_blocks(), if it is partial write in 4KB, it's not
> necessary to call f2fs_map_blocks() and set FI_PREALLOCATED_ALL flag.
> 
> Cc: Eric Biggers <ebiggers@google.com>
> Signed-off-by: Chao Yu <chao@kernel.org>
> ---
>  fs/f2fs/file.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index 5c2f99ada6be..1a3c29a9a6a0 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -4561,13 +4561,14 @@ static int f2fs_preallocate_blocks(struct kiocb *iocb, struct iov_iter *iter,
>  			return ret;
>  	}
>  
> -	/* Do not preallocate blocks that will be written partially in 4KB. */
>  	map.m_lblk = F2FS_BLK_ALIGN(pos);
>  	map.m_len = F2FS_BYTES_TO_BLK(pos + count);
> -	if (map.m_len > map.m_lblk)
> -		map.m_len -= map.m_lblk;
> -	else

		return 0;

We just need the above?

> -		map.m_len = 0;
> +
> +	/* Do not preallocate blocks that will be written partially in 4KB. */
> +	if (map.m_len <= map.m_lblk)
> +		return 0;
> +
> +	map.m_len -= map.m_lblk;
>  	map.m_may_create = true;
>  	if (dio) {
>  		map.m_seg_type = f2fs_rw_hint_to_seg_type(inode->i_write_hint);
> -- 
> 2.40.1

  reply	other threads:[~2023-12-11 22:09 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-10 11:35 [f2fs-dev] [PATCH 1/6] f2fs: fix to tag gcing flag on page during block migration Chao Yu
2023-12-10 11:35 ` Chao Yu
2023-12-10 11:35 ` [f2fs-dev] [PATCH 2/6] f2fs: fix to wait on block writeback for post_read case Chao Yu
2023-12-10 11:35   ` Chao Yu
2023-12-10 11:35 ` [f2fs-dev] [PATCH 3/6] f2fs: fix to check compress file in f2fs_move_file_range() Chao Yu
2023-12-10 11:35   ` Chao Yu
2023-12-10 11:35 ` [f2fs-dev] [PATCH 4/6] f2fs: don't set FI_PREALLOCATED_ALL for partial write Chao Yu
2023-12-10 11:35   ` Chao Yu
2023-12-11 22:08   ` Jaegeuk Kim [this message]
2023-12-11 22:08     ` Jaegeuk Kim
2023-12-10 11:35 ` [f2fs-dev] [PATCH 5/6] f2fs: fix to restrict condition of compress inode conversion Chao Yu
2023-12-10 11:35   ` Chao Yu
2023-12-11 22:11   ` [f2fs-dev] " Jaegeuk Kim
2023-12-11 22:11     ` Jaegeuk Kim
2023-12-12  1:05     ` [f2fs-dev] " Chao Yu
2023-12-12  1:05       ` Chao Yu
2023-12-12 22:21       ` [f2fs-dev] " Jaegeuk Kim
2023-12-12 22:21         ` Jaegeuk Kim
2023-12-28 15:33         ` [f2fs-dev] " Chao Yu
2023-12-28 15:33           ` Chao Yu
2024-01-02 22:54           ` [f2fs-dev] " Jaegeuk Kim
2024-01-02 22:54             ` Jaegeuk Kim
2024-01-11  3:07             ` [f2fs-dev] " Chao Yu
2024-01-11  3:07               ` Chao Yu
2023-12-10 11:35 ` [f2fs-dev] [PATCH 6/6] f2fs: fix to update iostat correctly in f2fs_filemap_fault() Chao Yu
2023-12-10 11:35   ` Chao Yu
2023-12-14 20:50 ` [f2fs-dev] [PATCH 1/6] f2fs: fix to tag gcing flag on page during block migration patchwork-bot+f2fs
2023-12-14 20:50   ` patchwork-bot+f2fs

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=ZXeIabjxfk8tN10r@google.com \
    --to=jaegeuk@kernel.org \
    --cc=chao@kernel.org \
    --cc=ebiggers@google.com \
    --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.