From: Christoph Hellwig <hch@lst.de>
To: Hannes Reinecke <hare@suse.de>
Cc: Martin Wilck <mwilck@suse.com>,
linux-nvme@lists.infradead.org, Sagi Grimberg <sagi@grimberg.me>,
Keith Busch <keith.busch@wdc.com>, Christoph Hellwig <hch@lst.de>
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:02:23 +0200 [thread overview]
Message-ID: <20200728080223.GA22321@lst.de> (raw)
In-Reply-To: <25b94bcf-1730-da16-6a1f-b68ffa4b8970@suse.de>
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;
}
--
2.27.0
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
next prev parent reply other threads:[~2020-07-28 8:02 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 [this message]
2020-07-28 8:14 ` Hannes Reinecke
2020-07-28 8:16 ` Christoph Hellwig
2020-07-28 8:18 ` Hannes Reinecke
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=20200728080223.GA22321@lst.de \
--to=hch@lst.de \
--cc=hare@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.