Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: fdmanana@kernel.org, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: increment extent count once when logging extents during fast fsync
Date: Fri, 11 Sep 2026 07:51:25 +0930	[thread overview]
Message-ID: <6b0481d1-a9af-42de-9da0-559019ceeb8f@suse.com> (raw)
In-Reply-To: <8f8353e08021070f6d5667386705d6b0d0dbbc47.1789057819.git.fdmanana@suse.com>



在 2026/9/11 02:05, fdmanana@kernel.org 写道:
> From: Filipe Manana <fdmanana@suse.com>
> 
> In btrfs_log_changed_extents() we increment the extent count twice, and
> we then fallback to a transaction commit if the count reaches a threshold
> of 32K. However we increment the count twice, which is confusing and
> pointless. So increment the count only once and reduce the threshold to
> half (16K).
> 
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

> ---
>   fs/btrfs/tree-log.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
> index a00094604e54..6c6b362d7f4c 100644
> --- a/fs/btrfs/tree-log.c
> +++ b/fs/btrfs/tree-log.c
> @@ -5350,7 +5350,7 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
>   		 * have a bunch of extents we just want to commit since it will
>   		 * be faster.
>   		 */
> -		if (++num > 32768) {
> +		if (++num > SZ_16K) {
>   			list_del_init(&tree->modified_extents);
>   			ret = -EFBIG;
>   			goto process;
> @@ -5368,7 +5368,6 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
>   		refcount_inc(&em->refs);
>   		em->flags |= EXTENT_FLAG_LOGGING;
>   		list_add_tail(&em->list, &extents);
> -		num++;
>   	}
>   
>   	list_sort(NULL, &extents, extent_cmp);


      reply	other threads:[~2026-09-10 22:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-10 16:35 [PATCH] btrfs: increment extent count once when logging extents during fast fsync fdmanana
2026-09-10 22:21 ` Qu Wenruo [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=6b0481d1-a9af-42de-9da0-559019ceeb8f@suse.com \
    --to=wqu@suse.com \
    --cc=fdmanana@kernel.org \
    --cc=linux-btrfs@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox