Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-nvme@lists.infradead.org, Sagi Grimberg <sagi@grimberg.me>,
	Keith Busch <keith.busch@wdc.com>, Martin Wilck <mwilck@suse.com>
Subject: Re: [PATCH 2/2] nvme-multipath: do not fall back to __nvme_find_path() for non-optimized paths
Date: Tue, 28 Jul 2020 10:18:38 +0200	[thread overview]
Message-ID: <52414c8f-bc38-be41-8093-e55a6831a43a@suse.de> (raw)
In-Reply-To: <20200728081632.GA22985@lst.de>

On 7/28/20 10:16 AM, Christoph Hellwig wrote:
> On Tue, Jul 28, 2020 at 10:14:14AM +0200, Hannes Reinecke wrote:
>> On 7/28/20 10:02 AM, Christoph Hellwig wrote:
>>> On Tue, Jul 28, 2020 at 08:25:18AM +0200, Hannes Reinecke wrote:
>>>>> Maybe instead of the early return put the following condition on else?
>>>>
>>>> That depends on whether we want to have a fallback to __nvme_find_path() or 
>>>> not. With your suggestion we would lose that; I'd rather keep it.
>>>
>>> Why would we want to fall back?  nvme_round_robin_path only
>>> returns NULL in case there is a single disabled path, in which
>>> case __nvme_find_path won't find anything either.  I'd go for something
>>> like this:
>>>
>>> ---
>>> From 4f578364a3d15898c7d715315a3371b2f71db416 Mon Sep 17 00:00:00 2001
>>> From: Hannes Reinecke <hare@suse.de>
>>> Date: Mon, 27 Jul 2020 18:08:03 +0200
>>> Subject: nvme-multipath: do not fall back to __nvme_find_path() for
>>>  non-optimized paths
>>>
>>> When nvme_round_robin_path() finds a valid namespace we should be using it;
>>> falling back to __nvme_find_path() for non-optimized paths will cause the
>>> result from nvme_round_robin_path() to be ignored for non-optimized paths.
>>>
>>> Signed-off-by: Martin Wilck <mwilck@suse.com>
>>> Signed-off-by: Hannes Reinecke <hare@suse.de>
>>> Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
>>> Signed-off-by: Christoph Hellwig <hch@lst.de>
>>> ---
>>>  drivers/nvme/host/multipath.c | 11 +++++++----
>>>  1 file changed, 7 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
>>> index 93c70e1591de8f..3ded54d2c9c6ad 100644
>>> --- a/drivers/nvme/host/multipath.c
>>> +++ b/drivers/nvme/host/multipath.c
>>> @@ -281,10 +281,13 @@ inline struct nvme_ns *nvme_find_path(struct nvme_ns_head *head)
>>>  	struct nvme_ns *ns;
>>>  
>>>  	ns = srcu_dereference(head->current_path[node], &head->srcu);
>>> -	if (READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_RR && ns)
>>> -		ns = nvme_round_robin_path(head, node, ns);
>>> -	if (unlikely(!ns || !nvme_path_is_optimized(ns)))
>>> -		ns = __nvme_find_path(head, node);
>>> +	if (unlikely(!ns))
>>> +		return __nvme_find_path(head, node);
>>> +
>>> +	if (READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_RR)
>>> +		return nvme_round_robin_path(head, node, ns);
>>> +	if (unlikely(!nvme_path_is_optimized(ns)))
>>> +		return __nvme_find_path(head, node);
>>>  	return ns;
>>>  }
>>>  
>>>
>>
>> Yes, that would work, too.
>>
>> Should I resend?
> 
> No need, I can apply it with the modification.   But if you have a
> RR test setup it would be great to run it through that again, just in
> case.
> 
I'm at it.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		           Kernel Storage Architect
hare@suse.de			                  +49 911 74053 688
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), GF: Felix Imendörffer

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

  reply	other threads:[~2020-07-28  8:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-27 16:08 [PATCH 0/2] nvme-multipath: fixes for non-optimized paths Hannes Reinecke
2020-07-27 16:08 ` [PATCH 1/2] nvme-multipath: fix logic " Hannes Reinecke
2020-07-27 19:42   ` Sagi Grimberg
2020-07-27 16:08 ` [PATCH 2/2] nvme-multipath: do not fall back to __nvme_find_path() " Hannes Reinecke
2020-07-27 19:46   ` Sagi Grimberg
2020-07-28  6:25     ` Hannes Reinecke
2020-07-28  6:43       ` Sagi Grimberg
2020-07-28  8:02       ` Christoph Hellwig
2020-07-28  8:14         ` Hannes Reinecke
2020-07-28  8:16           ` Christoph Hellwig
2020-07-28  8:18             ` Hannes Reinecke [this message]
2020-07-28 10:51 ` [PATCH 0/2] nvme-multipath: fixes " Christoph Hellwig

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=52414c8f-bc38-be41-8093-e55a6831a43a@suse.de \
    --to=hare@suse.de \
    --cc=hch@lst.de \
    --cc=keith.busch@wdc.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=mwilck@suse.com \
    --cc=sagi@grimberg.me \
    /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