From: Boris Burkov <boris@bur.io>
To: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Cc: Josef Bacik <josef@toxicpanda.com>,
David Sterba <dsterba@suse.com>,
Naohiro Aota <naohiro.aota@wdc.com>,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
Damien Le Moal <dlemoal@kernel.org>
Subject: Re: [PATCH 2/2] btrfs: zoned: wake up cleaner sooner if needed
Date: Mon, 22 Jan 2024 15:51:27 -0800 [thread overview]
Message-ID: <20240122235127.GA1695621@zen.localdomain> (raw)
In-Reply-To: <20240122-reclaim-fix-v1-2-761234a6d005@wdc.com>
On Mon, Jan 22, 2024 at 02:51:04AM -0800, Johannes Thumshirn wrote:
> On very fast but small devices, waiting for a transaction commit can be
> too long of a wait in order to wake up the cleaner kthread to remove unused
> and reclaimable block-groups.
>
> Check every time we're adding back free space to a block group, if we need
> to activate the cleaner kthread.
>
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> ---
> fs/btrfs/free-space-cache.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
> index d372c7ce0e6b..2d98b9ca0e83 100644
> --- a/fs/btrfs/free-space-cache.c
> +++ b/fs/btrfs/free-space-cache.c
> @@ -30,6 +30,7 @@
> #include "file-item.h"
> #include "file.h"
> #include "super.h"
> +#include "zoned.h"
>
> #define BITS_PER_BITMAP (PAGE_SIZE * 8UL)
> #define MAX_CACHE_BYTES_PER_GIG SZ_64K
> @@ -2694,6 +2695,7 @@ int __btrfs_add_free_space(struct btrfs_block_group *block_group,
> static int __btrfs_add_free_space_zoned(struct btrfs_block_group *block_group,
> u64 bytenr, u64 size, bool used)
> {
I thought add_free_space are only called from various error/backout
conditions and then for real from unpin_extent_range, which is also in
the transaction commit.
The normal reclaim/unused decision is made in btrfs_update_block_group
for that reason.
OTOH, I assume you had some repro that was performing poorly and this
patch fixed it so, I am very likely missing something.
Thanks,
Boris
> + struct btrfs_fs_info *fs_info = block_group->fs_info;
> struct btrfs_space_info *sinfo = block_group->space_info;
> struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl;
> u64 offset = bytenr - block_group->start;
> @@ -2745,6 +2747,10 @@ static int __btrfs_add_free_space_zoned(struct btrfs_block_group *block_group,
> btrfs_mark_bg_to_reclaim(block_group);
> }
>
> + if (btrfs_zoned_should_reclaim(fs_info) &&
> + !test_bit(BTRFS_FS_CLEANER_RUNNING, &fs_info->flags))
> + wake_up_process(fs_info->cleaner_kthread);
> +
> return 0;
> }
>
>
> --
> 2.43.0
>
next prev parent reply other threads:[~2024-01-22 23:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-22 10:51 [PATCH 0/2] btrfs: zoned: kick reclaim earlier on fast zoned devices Johannes Thumshirn
2024-01-22 10:51 ` [PATCH 1/2] btrfs: zoned: use rcu list for iterating devices to collect stats Johannes Thumshirn
2024-01-22 12:12 ` Naohiro Aota
2024-01-22 21:34 ` David Sterba
2024-01-23 7:49 ` Johannes Thumshirn
2024-01-23 18:35 ` David Sterba
2024-01-22 10:51 ` [PATCH 2/2] btrfs: zoned: wake up cleaner sooner if needed Johannes Thumshirn
2024-01-22 12:22 ` Naohiro Aota
2024-01-22 12:30 ` Johannes Thumshirn
2024-01-22 14:39 ` Naohiro Aota
2024-01-22 14:43 ` Johannes Thumshirn
2024-01-22 15:26 ` Naohiro Aota
2024-01-22 23:51 ` Boris Burkov [this message]
2024-01-22 16:04 ` [PATCH 0/2] btrfs: zoned: kick reclaim earlier on fast zoned devices Johannes Thumshirn
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=20240122235127.GA1695621@zen.localdomain \
--to=boris@bur.io \
--cc=dlemoal@kernel.org \
--cc=dsterba@suse.com \
--cc=johannes.thumshirn@wdc.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=naohiro.aota@wdc.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox