All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Naohiro Aota <naohiro.aota@wdc.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 2/3] btrfs: zoned: fix write time activation failure for metadata block group
Date: Mon, 7 Jul 2025 12:33:34 +0900	[thread overview]
Message-ID: <980ce4d7-fa7e-4320-8816-ab22d8021415@kernel.org> (raw)
In-Reply-To: <bb200206ae65453c68c2f3e316378838797e2502.1751611657.git.naohiro.aota@wdc.com>

On 7/7/25 11:44 AM, Naohiro Aota wrote:
> Since commit 13bb483d32ab ("btrfs: zoned: activate metadata block group on
> write time"), we activate a metadata block group on the write time. If the

on the write time -> at write time

> zone capacity is small enough, we can allocate the entire region before the
> first write. Then, we hit the btrfs_zoned_bg_is_full() in
> btrfs_zone_activate() and the activation fails.
> 
> For a data block group, we already check the fullness condition in the
> caller side. And, the fullness check is not necessary for metadata's
> write-time activation. Replace it with a proper WARN.

I am very confused by this explanation. If the BG is fully allocated before we
issue the first write, we still need to activate that BG, no ? So why the
WARN() ? That seems wrong to me. But I may not be understanding your
explanation, which means you need to clarify it :)

> 
> Fixes: 13bb483d32ab ("btrfs: zoned: activate metadata block group on write time")
> CC: stable@vger.kernel.org # 6.6+
> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
> ---
>  fs/btrfs/zoned.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
> index 6fb4d95412d6..9c354e84ab07 100644
> --- a/fs/btrfs/zoned.c
> +++ b/fs/btrfs/zoned.c
> @@ -2169,10 +2169,13 @@ bool btrfs_zone_activate(struct btrfs_block_group *block_group)
>  		goto out_unlock;
>  	}
>  
> -	/* No space left */
> -	if (btrfs_zoned_bg_is_full(block_group)) {
> -		ret = false;
> -		goto out_unlock;
> +	if (block_group->flags & BTRFS_BLOCK_GROUP_DATA) {
> +		if (WARN_ON_ONCE(btrfs_zoned_bg_is_full(block_group))) {
> +			ret = false;
> +			goto out_unlock;
> +		}
> +	} else {
> +		WARN_ON_ONCE(block_group->meta_write_pointer != block_group->start);
>  	}
>  
>  	for (i = 0; i < map->num_stripes; i++) {


-- 
Damien Le Moal
Western Digital Research

  reply	other threads:[~2025-07-07  3:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-07  2:44 [PATCH 0/3] btrfs: zoned: limitt active zones to max_open_zones Naohiro Aota
2025-07-07  2:44 ` [PATCH 1/3] btrfs: zoned: do not select metadata BG as finish target Naohiro Aota
2025-07-07  3:29   ` Damien Le Moal
2025-07-07  7:34   ` Johannes Thumshirn
2025-07-07  2:44 ` [PATCH 2/3] btrfs: zoned: fix write time activation failure for metadata block group Naohiro Aota
2025-07-07  3:33   ` Damien Le Moal [this message]
2025-07-08  5:04     ` Naohiro Aota
2025-07-08  5:11       ` Damien Le Moal
2025-07-07  2:44 ` [PATCH 3/3] btrfs: zoned: limit active zones to max_open_zones Naohiro Aota
2025-07-07  3:40   ` Damien Le Moal
2025-07-08  5:16     ` Naohiro Aota

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=980ce4d7-fa7e-4320-8816-ab22d8021415@kernel.org \
    --to=dlemoal@kernel.org \
    --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 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.