From: mwilck@suse.com
To: Christoph Hellwig <hch@lst.de>,
Keith Busch <keith.busch@intel.com>,
Sagi Grimberg <sagi@grimberg.me>
Cc: marting@netapp.com, Hannes Reinecke <hare@suse.de>,
linux-nvme@lists.infradead.org, Martin Wilck <mwilck@suse.com>
Subject: [PATCH 1/2] nvme: multipath: round-robin: fix logic for non-optimized paths
Date: Thu, 16 Jul 2020 21:59:28 +0200 [thread overview]
Message-ID: <20200716195929.28399-1-mwilck@suse.com> (raw)
From: Martin Wilck <mwilck@suse.com>
Handle the special case where we have exactly one optimized path,
which we should keep using in this case. Also, use the next
non-optimized path, not the last one.
Signed-off-by: Martin Wilck <mwilck@suse.com>
---
drivers/nvme/host/multipath.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index 74bad4e3d377..2c575b783d3e 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -224,13 +224,8 @@ static struct nvme_ns *nvme_next_ns(struct nvme_ns_head *head,
static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head,
int node, struct nvme_ns *old)
{
- struct nvme_ns *ns, *found, *fallback = NULL;
+ struct nvme_ns *ns, *found = NULL;
- if (list_is_singular(&head->list)) {
- if (nvme_path_is_disabled(old))
- return NULL;
- return old;
- }
for (ns = nvme_next_ns(head, old);
ns != old;
@@ -242,13 +237,19 @@ static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head,
found = ns;
goto out;
}
- if (ns->ana_state == NVME_ANA_NONOPTIMIZED)
- fallback = ns;
+ if (!found && ns->ana_state == NVME_ANA_NONOPTIMIZED)
+ found = ns;
}
- if (!fallback)
+ /* Fall back to old if it's better than the others */
+ if (!nvme_path_is_disabled(old) &&
+ (old->ana_state == NVME_ANA_OPTIMIZED ||
+ (!found && old->ana_state == NVME_ANA_NONOPTIMIZED)))
+ found = old;
+
+ if (!found)
return NULL;
- found = fallback;
+
out:
rcu_assign_pointer(head->current_path[node], found);
return found;
--
2.26.2
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
next reply other threads:[~2020-07-16 20:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-16 19:59 mwilck [this message]
2020-07-16 19:59 ` [PATCH 2/2] nvme: multipath: round-robin: don't fall back to numa mwilck
2020-07-17 6:10 ` Hannes Reinecke
2020-07-17 6:08 ` [PATCH 1/2] nvme: multipath: round-robin: fix logic for non-optimized paths Hannes Reinecke
2020-07-20 19:51 ` Sagi Grimberg
2020-07-21 6:39 ` Hannes Reinecke
2020-07-21 17:19 ` Sagi Grimberg
2020-07-22 5:35 ` Hannes Reinecke
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=20200716195929.28399-1-mwilck@suse.com \
--to=mwilck@suse.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=keith.busch@intel.com \
--cc=linux-nvme@lists.infradead.org \
--cc=marting@netapp.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;
as well as URLs for NNTP newsgroup(s).