From: "Dongjiang Zhu" <zhudongjiang@fygo.io>
To: "Naohiro Aota" <Naohiro.Aota@wdc.com>, <linux-btrfs@vger.kernel.org>
Cc: <johannes.thumshirn@wdc.com>
Subject: Re: [PATCH v2 1/4] btrfs: zoned: track only sequential zones as active
Date: Fri, 28 Aug 2026 20:03:04 +0800 [thread overview]
Message-ID: <3604f3af-2a44-4b8a-8b6b-67e8070308ed@fygo.io> (raw)
In-Reply-To: <DL0AVDP5O9C2.1VT2TYQXCL4B4@wdc.com>
在 2026/8/28 12:42, Naohiro Aota 写道:
> On Wed Aug 26, 2026 at 1:27 PM JST, Dongjiang Zhu wrote:
>> 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.
>>
>> Each unmatched reservation decrement lets data consume one more
>> sequential active-zone slot. Once the reservation becomes negative,
>> data can exhaust all such slots.
>
> Yes, apparently, this was not a problem previously, Because,
> max_active_zones > 0 mostly means there is no conventional zones. But,
> we changed the btrfs_get_max_active_zones() behavior to also use
> bdev_max_open_zones() to set the max_active_zones. This is a regressio
> introduced by that change, which deserves Fixes tag.
>
Agreed. I will add the Fixes tag in the next revision.
>>
>> [...]
>>
>> +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;
>
> Apparently, since we use bdev_max_open_zones() to populate
> zone_info->max_active_zones, we won't have max_active_zones == 0 now?
>
It can still be zero. btrfs_get_max_active_zones() initially assigns a
non-zero value, but btrfs_get_dev_zone_info() resets it to zero for
backward compatibility when nactive exceeds the derived limit and the
device reports no hardware max_active_zones limit. The per-device check
is therefore still needed.
>>
>> [...]
>>
>
> Also, as you dropped a BG on conventional zones from the
> zone_active_bgs, prepare_allocation_zoned() will never return the
> conventional BG to allocate with.
Thanks for pointing this out.
I intentionally changed zone_active_bgs so that conventional-only block
groups are excluded. I understood that this would also affect the
candidates used by prepare_allocation_zoned().
As I understand it, this is only an initial allocation hint. Conventional
block groups are no longer preferred through this path, but can still be
selected by the subsequent block group scan. Am I missing anything here?
My original plan was to address the allocation policy separately after this
series. I also compared the baseline and the full series with conventional
and sequential data/metadata workloads and did not observe a measurable
performance regression.
As a separate question, on devices with both conventional and sequential
zones, should allocation generally prefer conventional zones, or balance
them with active sequential zones? Besides preserving active-zone slots,
are there performance or endurance differences that should guide this
policy?
Thanks for the review,
Dongjiang Zhu
next prev parent reply other threads:[~2026-08-28 12:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 4:27 [PATCH v2 0/4] btrfs: zoned: fix active-zone accounting and transitions Dongjiang Zhu
2026-08-26 4:27 ` [PATCH v2 1/4] btrfs: zoned: track only sequential zones as active Dongjiang Zhu
2026-08-26 9:00 ` Johannes Thumshirn
2026-08-27 2:06 ` Dongjiang Zhu
2026-08-28 4:42 ` Naohiro Aota
2026-08-28 12:03 ` Dongjiang Zhu [this message]
2026-08-26 4:27 ` [PATCH v2 2/4] btrfs: zoned: recover active non-data block group roles on mount Dongjiang Zhu
2026-08-26 4:27 ` [PATCH v2 3/4] btrfs: zoned: remove obsolete non-data block group activation helper Dongjiang Zhu
2026-08-26 4:27 ` [PATCH v2 4/4] btrfs: zoned: serialize zone finishing per block group 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=3604f3af-2a44-4b8a-8b6b-67e8070308ed@fygo.io \
--to=zhudongjiang@fygo.io \
--cc=Naohiro.Aota@wdc.com \
--cc=johannes.thumshirn@wdc.com \
--cc=linux-btrfs@vger.kernel.org \
/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