From: Damien Le Moal <dlemoal@kernel.org>
To: Naohiro Aota <naohiro.aota@wdc.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 3/3] btrfs: zoned: limit active zones to max_open_zones
Date: Mon, 7 Jul 2025 12:40:55 +0900 [thread overview]
Message-ID: <17bd900f-78a2-4c24-911a-6c29c6e9a520@kernel.org> (raw)
In-Reply-To: <d2f36336c9eff5de35149223e9fd9b279028a804.1751611657.git.naohiro.aota@wdc.com>
On 7/7/25 11:44 AM, Naohiro Aota wrote:
> When there is no active zone limit, we can technically write into any
> number of zones at the same time. However, exceeding the max open zones can
> degrade performance. To prevent this, set the max_active_zones to
> bdev_max_open_zones() if there is no active zone limit.
>
> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
> ---
> fs/btrfs/zoned.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
> index 9c354e84ab07..bdcfabcb35e7 100644
> --- a/fs/btrfs/zoned.c
> +++ b/fs/btrfs/zoned.c
> @@ -418,6 +418,8 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache)
> zone_info->nr_zones++;
>
> max_active_zones = bdev_max_active_zones(bdev);
> + if (!max_active_zones)
> + max_active_zones = bdev_max_open_zones(bdev);
max_active_zones = min_not_zero(bdev_max_active_zones(bdev),
bdev_max_open_zones(bdev));
And what if the device has no limits at all ? (e.g. no max active limit and no
max open limit). In this case, max_active_zones will be zero. Should we perhaps
set in that case a default max_active zones ?
For information, the block layer zone write plugging defaults to create a 128
zones pull of write plugs if the device has no limits
(BLK_ZONE_WPLUG_DEFAULT_POOL_SIZE in block/blk-zoned.c). I would recommend
using that limit here too. So something like this:
/* Default number of max active zones when the device has no limits. */
#define BTRFS_ZONE_DEFAULT_MAX_ACTIVE 128
max_active_zones = min_not_zero(bdev_max_active_zones(bdev),
bdev_max_open_zones(bdev));
if (!max_active_zones &&
bdev_nr_zones(bdev) > BTRFS_ZONE_DEFAULT_MAX_ACTIVE)
max_active_zones = BTRFS_ZONE_DEFAULT_MAX_ACTIVE;
> if (max_active_zones && max_active_zones < BTRFS_MIN_ACTIVE_ZONES) {
> btrfs_err(fs_info,
> "zoned: %s: max active zones %u is too small, need at least %u active zones",
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2025-07-07 3:43 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
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 [this message]
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=17bd900f-78a2-4c24-911a-6c29c6e9a520@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox