From: Damien Le Moal <dlemoal@kernel.org>
To: Johannes Thumshirn <johannes.thumshirn@wdc.com>,
linux-btrfs@vger.kernel.org
Cc: Naohiro Aota <naohiro.aota@wdc.com>
Subject: Re: [PATCH 3/3] btrfs: zoned: limit number of zones reclaimed in flush_space
Date: Tue, 3 Mar 2026 16:41:13 +0900 [thread overview]
Message-ID: <75b7fcfe-f8d5-47ae-abbb-871e418cbda0@kernel.org> (raw)
In-Reply-To: <20260302143942.115619-4-johannes.thumshirn@wdc.com>
On 3/2/26 23:39, Johannes Thumshirn wrote:
> Limit the number of zones reclaimed in flush_space()'s RECLAIM_ZONES
> state.
>
> This prevents possibly long running reclaim sweeps to block other tasks in
> the system, while the system is under preassure anyways, causing the
s/preassure/pressure
> tasks to hang.
>
[...]
>
> To prevent these long running reclaims from blocking the system, only
> reclaim 5 block_groups in the RECLAIM_ZONES state of flush_space(). Also
5 seems very arbitrary. For a device with very large zones, this could still
take some time and cause the problem again. Why not iterate the block groups one
by one ? Is there any benefit to batching like this ?
> as these reclaims are now constrained, it opens up the use for a
> synchronous call to brtfs_reclaim_block_groups(), eliminating the need
> to place the reclaim task on a workqueue and then flushing the workqueue
> again.
>
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> -static int btrfs_reclaim_block_group(struct btrfs_block_group *bg)
> +static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaimed)
> {
> struct btrfs_fs_info *fs_info = bg->fs_info;
> struct btrfs_space_info *space_info = bg->space_info;
> @@ -2036,15 +2036,17 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg)
> if (space_info->total_bytes < old_total)
> btrfs_set_periodic_reclaim_ready(space_info, true);
> spin_unlock(&space_info->lock);
> + (*reclaimed)++;
If ret != 0, it means that btrfs_relocate_chunk() failed. So in that case,
shouldn't you skip incrementing the reclaimed counter ?
>
> return ret;
> }
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2026-03-03 7:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-02 14:39 [PATCH 0/3] btrfs: zoned: fix hang with generic/551 Johannes Thumshirn
2026-03-02 14:39 ` [PATCH 1/3] btrfs: move reclaiming of a single block group into its own function Johannes Thumshirn
2026-03-03 7:34 ` Damien Le Moal
2026-03-02 14:39 ` [PATCH 2/3] btrfs: create btrfs_reclaim_block_groups() Johannes Thumshirn
2026-03-03 7:34 ` Damien Le Moal
2026-03-02 14:39 ` [PATCH 3/3] btrfs: zoned: limit number of zones reclaimed in flush_space Johannes Thumshirn
2026-03-03 7:41 ` Damien Le Moal [this message]
2026-03-03 9:07 ` 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=75b7fcfe-f8d5-47ae-abbb-871e418cbda0@kernel.org \
--to=dlemoal@kernel.org \
--cc=johannes.thumshirn@wdc.com \
--cc=linux-btrfs@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