From: Filipe Manana <fdmanana@kernel.org>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 2/2] btrfs: defrag: remove an ambiguous condition for rejection
Date: Thu, 27 Jan 2022 10:49:05 +0000 [thread overview]
Message-ID: <YfJ4oQ+wEmk/CZfS@debian9.Home> (raw)
In-Reply-To: <0a2fdf173e68967239e4162fe08c434502ba7ea1.1643260816.git.wqu@suse.com>
On Thu, Jan 27, 2022 at 01:24:43PM +0800, Qu Wenruo wrote:
> From the very beginning of btrfs defrag, there is a check to reject
> extents which meet both conditions:
>
> - Physically adjacent
>
> We may want to defrag physically adjacent extents to reduce the number
> of extents or the size of subvolume tree.
>
> - Larger than 128K
>
> This may be there for compressed extents, but unfortunately 128K is
> exactly the max capacity for compressed extents.
> And the check is > 128K, thus it never rejects compressed extents.
>
> Furthermore, the compressed extent capacity bug is fixed by previous
> patch, there is no reason for that check anymore.
>
> The original check has a very small ranges to reject (the target extent
> size is > 128K, and default extent threshold is 256K), and for
> compressed extent it doesn't work at all.
>
> So it's better just to remove the rejection, and allow us to defrag
> physically adjacent extents.
>
> Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Looks good now, thanks.
> ---
> fs/btrfs/ioctl.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
> index a03c31e1ff18..af95e3b7aa72 100644
> --- a/fs/btrfs/ioctl.c
> +++ b/fs/btrfs/ioctl.c
> @@ -1078,10 +1078,6 @@ static bool defrag_check_next_extent(struct inode *inode, struct extent_map *em,
> */
> if (next->len >= get_extent_max_capacity(em))
> goto out;
> - /* Physically adjacent and large enough */
> - if ((em->block_start + em->block_len == next->block_start) &&
> - (em->block_len > SZ_128K && next->block_len > SZ_128K))
> - goto out;
> ret = true;
> out:
> free_extent_map(next);
> --
> 2.34.1
>
next prev parent reply other threads:[~2022-01-27 10:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-27 5:24 [PATCH 0/2] btrfs: defrag: don't defrag extents already at their max capacity, then remove an ambiguous check Qu Wenruo
2022-01-27 5:24 ` [PATCH 1/2] btrfs: defrag: don't defrag extents which is already at its max capacity Qu Wenruo
2022-01-27 10:48 ` Filipe Manana
2022-01-27 5:24 ` [PATCH 2/2] btrfs: defrag: remove an ambiguous condition for rejection Qu Wenruo
2022-01-27 10:49 ` Filipe Manana [this message]
2022-01-27 10:53 ` [PATCH 0/2] btrfs: defrag: don't defrag extents already at their max capacity, then remove an ambiguous check Filipe Manana
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=YfJ4oQ+wEmk/CZfS@debian9.Home \
--to=fdmanana@kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=wqu@suse.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.