From: Qu Wenruo <wqu@suse.com>
To: fdmanana@kernel.org, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: defrag: fix check to see if next extent can be defragged too
Date: Thu, 8 Oct 2026 07:36:06 +1030 [thread overview]
Message-ID: <44c7d7f9-8ca5-4f55-92d2-debc8c22a612@suse.com> (raw)
In-Reply-To: <28749bc33ebb6dbb85b0acd298fbff300fc5d731.1791386424.git.fdmanana@suse.com>
在 2026/10/8 01:50, fdmanana@kernel.org 写道:
> From: Filipe Manana <fdmanana@suse.com>
>
> We want to check if the next extent is at maximum capacity but we are
> passing the current extent map to get_extent_max_capacity() and not
> the next extent map. For example if the current extent is compressed (its
> maximum capacity is 128K) and the next extent is uncompressed (its
> maximum capacity is 128M), then we can bail out and not defrag the next
> extent too - when for example the next extent as a size of 128K, is
> uncompressed, and the extent threshold is >= 256K.
>
> Fixes: 979b25c300db ("btrfs: defrag: don't defrag extents which are already at max capacity")
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Thanks,
Qu
> ---
> fs/btrfs/defrag.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/defrag.c b/fs/btrfs/defrag.c
> index 75c87aee5de9..7010d714cfe1 100644
> --- a/fs/btrfs/defrag.c
> +++ b/fs/btrfs/defrag.c
> @@ -811,7 +811,7 @@ static bool defrag_check_next_extent(struct inode *inode, struct extent_map *em,
> * If the next extent is at its max capacity, defragging current extent
> * makes no sense, as the total number of extents won't change.
> */
> - if (next->len >= get_extent_max_capacity(fs_info, em))
> + if (next->len >= get_extent_max_capacity(fs_info, next))
> goto out;
> /* Skip older extent */
> if (next->generation < newer_than)
prev parent reply other threads:[~2026-10-07 21:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-07 15:20 [PATCH] btrfs: defrag: fix check to see if next extent can be defragged too fdmanana
2026-10-07 21:06 ` 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=44c7d7f9-8ca5-4f55-92d2-debc8c22a612@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 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.