Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme-multipath: set nr_zones for zoned namespaces
@ 2021-02-05 19:50 Keith Busch
  2021-02-07 16:16 ` Christoph Hellwig
  2021-02-07 23:06 ` Damien Le Moal
  0 siblings, 2 replies; 8+ messages in thread
From: Keith Busch @ 2021-02-05 19:50 UTC (permalink / raw)
  To: linux-nvme, sagi, hch; +Cc: Keith Busch, Damien Le Moal, Minwoo Im

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.

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>
---
 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 1427c9555cef..a1d476e1ac02 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)
 	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)
-- 
2.25.4


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] nvme-multipath: set nr_zones for zoned namespaces
  2021-02-05 19:50 [PATCH] nvme-multipath: set nr_zones for zoned namespaces Keith Busch
@ 2021-02-07 16:16 ` Christoph Hellwig
  2021-02-07 23:06 ` Damien Le Moal
  1 sibling, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2021-02-07 16:16 UTC (permalink / raw)
  To: Keith Busch; +Cc: Damien Le Moal, Minwoo Im, sagi, linux-nvme, hch

Thanks,

applied to nvme-5.12.

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] nvme-multipath: set nr_zones for zoned namespaces
  2021-02-05 19:50 [PATCH] nvme-multipath: set nr_zones for zoned namespaces Keith Busch
  2021-02-07 16:16 ` Christoph Hellwig
@ 2021-02-07 23:06 ` Damien Le Moal
  2021-02-08  3:28   ` Keith Busch
  1 sibling, 1 reply; 8+ messages in thread
From: Damien Le Moal @ 2021-02-07 23:06 UTC (permalink / raw)
  To: Keith Busch, linux-nvme@lists.infradead.org, sagi@grimberg.me,
	hch@lst.de
  Cc: Minwoo Im

On 2021/02/06 4:50, Keith Busch wrote:
> 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.
> 
> 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>

Shouldn't this have a Fixes tag ?

> ---
>  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 1427c9555cef..a1d476e1ac02 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)
>  	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...

>  }
>  
>  void nvme_mpath_remove_disk(struct nvme_ns_head *head)
> 


-- 
Damien Le Moal
Western Digital Research

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] nvme-multipath: set nr_zones for zoned namespaces
  2021-02-07 23:06 ` Damien Le Moal
@ 2021-02-08  3:28   ` Keith Busch
  2021-02-08  3:51     ` Damien Le Moal
  0 siblings, 1 reply; 8+ messages in thread
From: Keith Busch @ 2021-02-08  3:28 UTC (permalink / raw)
  To: Damien Le Moal
  Cc: Minwoo Im, sagi@grimberg.me, linux-nvme@lists.infradead.org,
	hch@lst.de

On Sun, Feb 07, 2021 at 11:06:36PM +0000, Damien Le Moal wrote:
> On 2021/02/06 4:50, Keith Busch wrote:
> > 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.
> > 
> > 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>
> 
> 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")
 
> > ---
> >  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 1427c9555cef..a1d476e1ac02 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)
> >  	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
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] nvme-multipath: set nr_zones for zoned namespaces
  2021-02-08  3:28   ` Keith Busch
@ 2021-02-08  3:51     ` Damien Le Moal
  2021-02-08 14:57       ` Minwoo Im
  2021-02-08 15:14       ` Keith Busch
  0 siblings, 2 replies; 8+ messages in thread
From: Damien Le Moal @ 2021-02-08  3:51 UTC (permalink / raw)
  To: Keith Busch
  Cc: Minwoo Im, sagi@grimberg.me, linux-nvme@lists.infradead.org,
	hch@lst.de

On 2021/02/08 12:28, Keith Busch wrote:
> On Sun, Feb 07, 2021 at 11:06:36PM +0000, Damien Le Moal wrote:
>> On 2021/02/06 4:50, Keith Busch wrote:
>>> 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.
>>>
>>> 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>
>>
>> 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")
>  
>>> ---
>>>  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 1427c9555cef..a1d476e1ac02 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)
>>>  	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().

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 ?


-- 
Damien Le Moal
Western Digital Research

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] nvme-multipath: set nr_zones for zoned namespaces
  2021-02-08  3:51     ` Damien Le Moal
@ 2021-02-08 14:57       ` Minwoo Im
  2021-02-08 15:05         ` hch
  2021-02-08 15:14       ` Keith Busch
  1 sibling, 1 reply; 8+ messages in thread
From: Minwoo Im @ 2021-02-08 14:57 UTC (permalink / raw)
  To: Damien Le Moal
  Cc: Keith Busch, sagi@grimberg.me, linux-nvme@lists.infradead.org,
	hch@lst.de

> 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
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] nvme-multipath: set nr_zones for zoned namespaces
  2021-02-08 14:57       ` Minwoo Im
@ 2021-02-08 15:05         ` hch
  0 siblings, 0 replies; 8+ messages in thread
From: hch @ 2021-02-08 15:05 UTC (permalink / raw)
  To: Minwoo Im
  Cc: Keith Busch, Damien Le Moal, sagi@grimberg.me,
	linux-nvme@lists.infradead.org, hch@lst.de

On Mon, Feb 08, 2021 at 11:57:47PM +0900, Minwoo Im wrote:
> 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.

> 	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.

> 	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
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] nvme-multipath: set nr_zones for zoned namespaces
  2021-02-08  3:51     ` Damien Le Moal
  2021-02-08 14:57       ` Minwoo Im
@ 2021-02-08 15:14       ` Keith Busch
  1 sibling, 0 replies; 8+ messages in thread
From: Keith Busch @ 2021-02-08 15:14 UTC (permalink / raw)
  To: Damien Le Moal
  Cc: Minwoo Im, sagi@grimberg.me, linux-nvme@lists.infradead.org,
	hch@lst.de

On Mon, Feb 08, 2021 at 03:51:18AM +0000, Damien Le Moal wrote:
> 
> 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
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-02-08 15:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-05 19:50 [PATCH] nvme-multipath: set nr_zones for zoned namespaces Keith Busch
2021-02-07 16:16 ` Christoph Hellwig
2021-02-07 23:06 ` Damien Le Moal
2021-02-08  3:28   ` Keith Busch
2021-02-08  3:51     ` Damien Le Moal
2021-02-08 14:57       ` Minwoo Im
2021-02-08 15:05         ` hch
2021-02-08 15:14       ` Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox