Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Boris Burkov <boris@bur.io>
To: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Cc: linux-btrfs@vger.kernel.org, Naohiro Aota <naohiro.aota@wdc.com>
Subject: Re: [PATCH] btrfs: zoned: handle RAID profiles in btrfs_can_activate_zone()
Date: Mon, 31 Aug 2026 14:58:41 -0700	[thread overview]
Message-ID: <20260831215841.GE325502@zen.localdomain> (raw)
In-Reply-To: <20260824161910.2009296-1-johannes.thumshirn@wdc.com>

On Mon, Aug 24, 2026 at 06:19:10PM +0200, Johannes Thumshirn wrote:
> btrfs_can_activate_zone() only accounts for the single and DUP profiles.
> For a RAID0, RAID1, RAID1C3, RAID1C4 or RAID10 block group the profile
> switch matches no case, so 'ret' stays false and the function reports
> that no zone can be activated, even when the devices have plenty of
> active zones left.
> 
> As a side effect BTRFS_FS_NEED_ZONE_FINISH gets set and, since
> btrfs_can_activate_zone() bails out early once that bit is set, data
> allocations will fail permanently: writers loop on -EAGAIN and hang in
> btrfs_new_extent_direct() waiting for the bit to clear.
> 
> Each of these profiles needs one active zone per device, just like
> single, so handle them the same way.
> 
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Boris Burkov <boris@bur.io>
> ---
>  fs/btrfs/zoned.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
> index 9d448cdd60c4..107833fcf2be 100644
> --- a/fs/btrfs/zoned.c
> +++ b/fs/btrfs/zoned.c
> @@ -2689,6 +2689,11 @@ bool btrfs_can_activate_zone(struct btrfs_fs_devices *fs_devices, u64 flags)
>  
>  		switch (flags & BTRFS_BLOCK_GROUP_PROFILE_MASK) {
>  		case 0: /* single */
> +		case BTRFS_BLOCK_GROUP_RAID0:
> +		case BTRFS_BLOCK_GROUP_RAID1:
> +		case BTRFS_BLOCK_GROUP_RAID1C3:
> +		case BTRFS_BLOCK_GROUP_RAID1C4:
> +		case BTRFS_BLOCK_GROUP_RAID10:
>  			ret = (atomic_read(&zinfo->active_zones_left) >= (1 + reserved));
>  			break;
>  		case BTRFS_BLOCK_GROUP_DUP:
> -- 
> 2.55.0
> 

      reply	other threads:[~2026-08-31 21:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-24 16:19 [PATCH] btrfs: zoned: handle RAID profiles in btrfs_can_activate_zone() Johannes Thumshirn
2026-08-31 21:58 ` Boris Burkov [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=20260831215841.GE325502@zen.localdomain \
    --to=boris@bur.io \
    --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