From: "Dongjiang Zhu" <zhudongjiang@fygo.io>
To: "Johannes Thumshirn" <johannes.thumshirn@wdc.com>
Cc: <linux-btrfs@vger.kernel.org>, <naohiro.aota@wdc.com>
Subject: Re: [PATCH 1/4] btrfs: zoned: track only sequential zones as active
Date: Tue, 25 Aug 2026 11:01:49 +0800 [thread overview]
Message-ID: <cdafbb62-cf65-46aa-a3bf-d04c6ad94768@fygo.io> (raw)
In-Reply-To: <aoxL1ZK42wn7VIwQ@mayhem.fritz.box>
在 2026/8/24 21:55, Johannes Thumshirn 写道:
> On Mon, Aug 24, 2026 at 02:49:53PM +0800, Dongjiang Zhu wrote:
>> [CAUSE]
>> The runtime activation and finish paths apply active-zone accounting to
>> both conventional and sequential stripes.
>>
>> At mount, however, active_zones_left is rebuilt from device zone
>> conditions. Conventional zones report NOT_WP and are therefore not
>> included. Meanwhile, all-conventional block groups are marked active
>> and added to zone_active_bgs, so mount recovery still decreases
>> reserved_active_zones for their metadata and system stripes.
>>
>> The two counters can therefore diverge across a remount.
>>
>> [BUG]
>> Each unmatched reservation decrement lets data consume one more
>> sequential active-zone slot. Once the reservation becomes negative,
>> data can exhaust all such slots.
>>
>> A later transition from a conventional metadata or system target to a
>> sequential one can then fail, because finishing the conventional target
>> does not release a sequential active-zone slot.
>>
>> If this happens during synchronous transaction writeback,
>> btrfs_check_meta_write_pointer() returns -EAGAIN. The transaction is
>> then aborted and the filesystem is forced read-only.
>>
>> The reservation mismatch was reproduced by creating small files with
>> large xattrs in batches, syncing them and remounting an HC620 filesystem
>> using SINGLE profiles:
>>
>> active_zones_left: 126
>> reserved_active_zones: 3 -> -8
>>
>> The active list contained one partially used conventional system block
>> group, nine full conventional metadata block groups and one partially
>> used conventional metadata block group.
>>
>> [FIX]
>> Use sequential stripes as the unit of active-zone tracking.
>>
>> Do not mark all-conventional block groups active. Only sequential
>> stripes update the active-zone bitmap and non-data reservation during
>> activation, finish and mount recovery.
>>
>> Assisted-by: LLM
>> Signed-off-by: Dongjiang Zhu<zhudongjiang@fygo.io>
> Looks good, two small nits though in case you need to resend the series:
> 1) Please don't do the [CAUSE], [BUG], [FIX] thingy, I know Qu does it but
> noone else does that.
Sure, I will remove these headings from the commit messages in v2.
> 2) We now have a repeated pattern of:
>
> if (!btrfs_dev_is_sequential())
> return
> if (max_active_zones)
> return
>
> Maybe have a helper for that? Something like
>
> static inline bool btrfs_needs_active_zone_tracking(struct btrfs_device *dev,
> u64 physical)
> {
> if (!btrfs_dev_is_sequential(dev, physical))
> return false;
>
> if (dev->zone_info->max_active_zones == 0)
> return false;
>
> return true;
> }
>
Good idea. I will add the helper and use it for the repeated checks in
v2.
Thanks for the review.
Dongjiang Zhu
> Otherwise looks good,
> Reviewed-by: Johannes Thumshirn<johannes.thumshirn@wdc.com>
>
next prev parent reply other threads:[~2026-08-25 3:02 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-24 6:49 [PATCH 0/4] btrfs: zoned: fix active-zone accounting and transitions Dongjiang Zhu
2026-08-24 6:49 ` [PATCH 1/4] btrfs: zoned: track only sequential zones as active Dongjiang Zhu
2026-08-24 13:55 ` Johannes Thumshirn
2026-08-24 22:40 ` Qu Wenruo
2026-08-25 9:10 ` Johannes Thumshirn
2026-08-25 3:01 ` Dongjiang Zhu [this message]
2026-08-24 6:49 ` [PATCH 2/4] btrfs: zoned: recover active non-data block group roles on mount Dongjiang Zhu
2026-08-24 14:42 ` Johannes Thumshirn
2026-08-25 3:08 ` Dongjiang Zhu
2026-08-25 10:02 ` Johannes Thumshirn
2026-08-24 6:49 ` [PATCH 3/4] btrfs: zoned: remove obsolete non-data block group activation helper Dongjiang Zhu
2026-08-24 15:51 ` Johannes Thumshirn
2026-08-24 6:49 ` [PATCH 4/4] btrfs: zoned: serialize zone finishing per block group Dongjiang Zhu
2026-08-24 16:00 ` Johannes Thumshirn
2026-08-25 3:16 ` Dongjiang Zhu
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=cdafbb62-cf65-46aa-a3bf-d04c6ad94768@fygo.io \
--to=zhudongjiang@fygo.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 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.