* [PATCH v3] nvme: refresh multipath head zoned limits from path limits
@ 2026-05-26 7:25 Yao Sang
2026-05-27 13:35 ` Christoph Hellwig
0 siblings, 1 reply; 2+ messages in thread
From: Yao Sang @ 2026-05-26 7:25 UTC (permalink / raw)
To: linux-nvme; +Cc: kbusch, axboe, hch, sagi, shinichiro.kawasaki, Yao Sang
queue_limits_stack_bdev() updates the multipath head limits from the
path queue, but it does not propagate max_open_zones or
max_active_zones. As a result, a zoned multipath namespace head can
keep stale 0/0 values even after a ready path reports finite zoned
resource limits.
When refreshing the head limits in nvme_update_ns_info(), update the
zoned limits directly after stacking the path queue limits. Clamp
max_open_zones and max_active_zones against the current path limits
with min_not_zero(), and clear both fields when the resulting queue is
not zoned.
This avoids advertising "no limit" on the multipath head while keeping
the zoned-limit handling local to the nvme multipath update path.
Signed-off-by: Yao Sang <sangyao@kylinos.cn>
---
Changes in v3:
- Keep the fix local to the NVMe multipath update path, as suggested
in review
- Drop the helper and update the zoned limits directly in
nvme_update_ns_info().
- Keep explicit clearing of both zoned-limit fields when the resulting
queue is not zoned.
Testing:
- blktests: nvme/005, nvme/057, nvme/058
- blktests: zbd/011, zbd/012, zbd/013, block/004
- blktests on /dev/nvme0n1: zbd/001, zbd/002, zbd/003, zbd/004,
zbd/005, zbd/006
Link to v1:
https://lore.kernel.org/r/20260520091237.392802-1-sangyao@kylinos.cn
Link to v2:
https://lore.kernel.org/all/20260522075806.3168366-1-sangyao@kylinos.cn
drivers/nvme/host/core.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index c3032d6ad6b1..18383a70e2c5 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2549,6 +2549,15 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_ns_info *info)
lim.io_opt = ns_lim->io_opt;
queue_limits_stack_bdev(&lim, ns->disk->part0, 0,
ns->head->disk->disk_name);
+ if (lim.features & BLK_FEAT_ZONED) {
+ lim.max_open_zones = min_not_zero(lim.max_open_zones,
+ ns_lim->max_open_zones);
+ lim.max_active_zones = min_not_zero(lim.max_active_zones,
+ ns_lim->max_active_zones);
+ } else {
+ lim.max_open_zones = 0;
+ lim.max_active_zones = 0;
+ }
if (unsupported)
ns->head->disk->flags |= GENHD_FL_HIDDEN;
else
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH v3] nvme: refresh multipath head zoned limits from path limits
2026-05-26 7:25 [PATCH v3] nvme: refresh multipath head zoned limits from path limits Yao Sang
@ 2026-05-27 13:35 ` Christoph Hellwig
0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2026-05-27 13:35 UTC (permalink / raw)
To: Yao Sang; +Cc: linux-nvme, kbusch, axboe, sagi, shinichiro.kawasaki
Hi Yao,
thanks for the patch.
On Tue, May 26, 2026 at 03:25:29PM +0800, Yao Sang wrote:
> + if (lim.features & BLK_FEAT_ZONED) {
> + lim.max_open_zones = min_not_zero(lim.max_open_zones,
> + ns_lim->max_open_zones);
> + lim.max_active_zones = min_not_zero(lim.max_active_zones,
> + ns_lim->max_active_zones);
A bunch for overly long lines here. And I think this would become a lot
more readable by factoring it into a little helper:
static void nvme_stack_zone_resources(struct queue_limits *t,
const struct queue_limits *b)
{
t->max_open_zones = min_not_zero(t->max_open_zones, b->max_open_zones);
t->max_active_zones =
min_not_zero(t->max_active_zones, b->max_active_zones);
}
and then call that.
> + } else {
> + lim.max_open_zones = 0;
> + lim.max_active_zones = 0;
> + }
and we should not need this, as the values should already be zeroed
when BLK_FEAT_ZONED is not set.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-05-27 13:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-26 7:25 [PATCH v3] nvme: refresh multipath head zoned limits from path limits Yao Sang
2026-05-27 13:35 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox