Blob Blame History Raw
From: Keith Busch <kbusch@kernel.org>
Date: Fri, 5 Feb 2021 11:50:02 -0800
Subject: [PATCH] nvme-multipath: set nr_zones for zoned namespaces
Git-commit: 73a1a2298f3e9df24cea7a9aab412ba9470f6159
Patch-mainline: v5.12-rc1
References: git-fixes

The bio based drivers only require the request_queue's nr_zones is set,
so set this field in the head if the namespace path is zoned.

[hare: backport due to missing commit 1cb039f3dc16
("bdi: replace BDI_CAP_STABLE_WRITES with a queue and a sb flag") ]

Fixes: 240e6ee272c07 ("nvme: support for zoned namespaces")
Reported-by: Minwoo Im <minwoo.im.dev@gmail.com>
Cc: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Hannes Reinecke <hare@suse.com>
---
 drivers/nvme/host/multipath.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index 65bd6efa5e1c..0696319adaf6 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -677,6 +677,10 @@ void nvme_mpath_add_disk(struct nvme_ns *ns, struct nvme_id_ns *id)
 			disk->queue->backing_dev_info->capabilities |=
 					BDI_CAP_STABLE_WRITES;
 	}
+#ifdef CONFIG_BLK_DEV_ZONED
+	if (blk_queue_is_zoned(ns->queue) && ns->head->disk)
+		ns->head->disk->queue->nr_zones = ns->queue->nr_zones;
+#endif
 }
 
 void nvme_mpath_remove_disk(struct nvme_ns_head *head)
-- 
2.29.2