Skip to contentSkip to conversation

nvme-multipath: set nr_zones for zoned namespaces

PATCH Applied Keith Busch 4 participants 8 messages Feb 5, 2021 – Feb 8, 2021 NVMe

lore
Share & tools
lore

Keith Busch

author maintainer
#0 lore raw

PATCH 1/1 nvme-multipath: set nr_zones for zoned namespaces

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.

---
 drivers/nvme/host/multipath.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/nvme/host/multipath.c +4 -0
index 1427c9555cef..a1d476e1ac02 100644
@@ -677,6 +677,10 @@ void nvme_mpath_add_disk(struct nvme_ns *ns, struct nvme_id_ns *id)
 	if (blk_queue_stable_writes(ns->queue) && ns->head->disk)
 		blk_queue_flag_set(QUEUE_FLAG_STABLE_WRITES,
 				   ns->head->disk->queue);
+#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)
Signature · 7 lines
2.25.4


_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
#2 lore raw
In reply to Keith Busch
Quoted 6 lines · Keith Busch

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.

Shouldn't this have a Fixes tag ?

Quoted 9 lines
---
 drivers/nvme/host/multipath.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/nvme/host/multipath.c +0 -0
index 1427c9555cef..a1d476e1ac02 100644

drivers/nvme/host/multipath.c void nvme_mpath_add_disk(struct nvme_ns *ns, struct nvme_id_ns *id) · line 683

Quoted 7 lines
drivers/nvme/host/multipath.c +4 -0
@@ -677,6 +677,10 @@ void nvme_mpath_add_disk(struct nvme_ns *ns, struct nvme_id_ns *id)
 	if (blk_queue_stable_writes(ns->queue) && ns->head->disk)
 		blk_queue_flag_set(QUEUE_FLAG_STABLE_WRITES,
 				   ns->head->disk->queue);
+#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

Is the zone model set already ? I have not checked...

Quoted 4 lines
drivers/nvme/host/multipath.c +0 -0
 }
 
 void nvme_mpath_remove_disk(struct nvme_ns_head *head)
Signature · 7 lines
Damien Le Moal
Western Digital Research

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
author maintainer
#3 lore raw
Quoted 9 lines · Damien Le Moal
Quoted 6 lines · Keith Busch

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.

Shouldn't this have a Fixes tag ?

Probably yes, since this omission does go back to the initial inclusion:

Fixes 240e6ee272c07 ("nvme: support for zoned namespaces")
Quoted 4 lines
Quoted 4 lines
---
 drivers/nvme/host/multipath.c | 4 ++++
 1 file changed, 4 insertions(+)
Quoted 14 lines

drivers/nvme/host/multipath.c void nvme_mpath_add_disk(struct nvme_ns *ns, struct nvme_id_ns *id) · line 683

Quoted 12 lines
drivers/nvme/host/multipath.c +4 -0
index 1427c9555cef..a1d476e1ac02 100644
@@ -677,6 +677,10 @@ void nvme_mpath_add_disk(struct nvme_ns *ns, struct nvme_id_ns *id)
 	if (blk_queue_stable_writes(ns->queue) && ns->head->disk)
 		blk_queue_flag_set(QUEUE_FLAG_STABLE_WRITES,
 				   ns->head->disk->queue);
+#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

Is the zone model set already ? I have not checked...

That's a good question, and we should be safe with the zone namespace's zone settings set at this point: nvme_mpath_add_disk() is invoked after nvme_update_ns_info().

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

#4 lore raw
Quoted 34 lines · Keith Busch
Quoted 9 lines · Damien Le Moal
Quoted 6 lines · Keith Busch

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.

Shouldn't this have a Fixes tag ?

Probably yes, since this omission does go back to the initial inclusion:

Fixes 240e6ee272c07 ("nvme: support for zoned namespaces")
Quoted 4 lines
Quoted 4 lines
---
 drivers/nvme/host/multipath.c | 4 ++++
 1 file changed, 4 insertions(+)
Quoted 14 lines

drivers/nvme/host/multipath.c void nvme_mpath_add_disk(struct nvme_ns *ns, struct nvme_id_ns *id) · line 683

Quoted 12 lines
drivers/nvme/host/multipath.c +4 -0
index 1427c9555cef..a1d476e1ac02 100644
@@ -677,6 +677,10 @@ void nvme_mpath_add_disk(struct nvme_ns *ns, struct nvme_id_ns *id)
 	if (blk_queue_stable_writes(ns->queue) && ns->head->disk)
 		blk_queue_flag_set(QUEUE_FLAG_STABLE_WRITES,
 				   ns->head->disk->queue);
+#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

Is the zone model set already ? I have not checked...

Quoted 3 lines

That's a good question, and we should be safe with the zone namespace's zone settings set at this point: nvme_mpath_add_disk() is invoked after nvme_update_ns_info().

Hmmm... I see the zone model being set for ns->queue, but nothing for ns->head->disk->queue... Shoudln't nvme_mpath_add_disk() also set the zoned model for ns->head->disk->queue ?

Signature · 7 lines
Damien Le Moal
Western Digital Research

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
#5 lore raw
Quoted 3 lines

Hmmm... I see the zone model being set for ns->queue, but nothing for ns->head->disk->queue... Shoudln't nvme_mpath_add_disk() also set the zoned model for ns->head->disk->queue ?

I think zone model shows properly with the simple multi-path example:

	cat /sys/block/nvme0n1/queue/zoned:		host-managed
	cat /sys/block/nvme0c0n1/queue/zoned:		host-managed
	cat /sys/block/nvme0n1/queue/nr_zones:		0
	cat /sys/block/nvme0c0n1/queue/nr_zones:	2048

But, there are also little more differences between the path namespace and head namespace:

	cat /sys/block/nvme0n1/queue/nr_requests:	128
	cat /sys/block/nvme0c0n1/queue/nr_requests:	1023
	cat /sys/block/nvme0n1/queue/iostats:		0
	cat /sys/block/nvme0c0n1/queue/iostats:		1
	cat /sys/block/nvme0n1/queue/rq_affinity:	0
	cat /sys/block/nvme0c0n1/queue/rq_affinity:	1

+ Question with Damien's one: Shouldn't we sync all the differences between the two request_queues?

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

#6 lore raw
Quoted 5 lines · Minwoo Im

But, there are also little more differences between the path namespace and head namespace:

	cat /sys/block/nvme0n1/queue/nr_requests:	128
	cat /sys/block/nvme0c0n1/queue/nr_requests:	1023

nr_request is a noop for bio-based drivers.

Quoted 2 lines
	cat /sys/block/nvme0n1/queue/iostats:		0
	cat /sys/block/nvme0c0n1/queue/iostats:		1

iostats for bio based drivers require extra code, and we don't really need those.

Quoted 2 lines
	cat /sys/block/nvme0n1/queue/rq_affinity:	0
	cat /sys/block/nvme0c0n1/queue/rq_affinity:	1

rq_affinity is a noop for bio based drivers.

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

author maintainer
#7 lore raw
In reply to Damien Le Moal
Quoted 4 lines · Damien Le Moal

Hmmm... I see the zone model being set for ns->queue, but nothing for ns->head->disk->queue... Shoudln't nvme_mpath_add_disk() also set the zoned model for ns->head->disk->queue ?

That gets set via nvme_update_ns_info()->blk_stack_limits().

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme