summaryrefslogtreecommitdiffstats
path: root/drivers/nvme
diff options
context:
space:
mode:
authorMartin Wilck <mwilck@suse.com>2020-08-06 15:19:32 +0200
committerJens Axboe <axboe@kernel.dk>2020-08-22 01:14:27 +0200
commite398863b75af24103cee69cc8ee8bf4bc9c8913e (patch)
tree2b278284b4d60afe0a8fc5c1ae4c6e8354a5883a /drivers/nvme
parentnvme: multipath: round-robin: fix single non-optimized path case (diff)
downloadlinux-e398863b75af24103cee69cc8ee8bf4bc9c8913e.tar.xz
linux-e398863b75af24103cee69cc8ee8bf4bc9c8913e.zip
nvme: multipath: round-robin: eliminate "fallback" variable
If we find an optimized path, we quit the loop immediately. Thus we can use just one variable for the next path, slighly simplifying the code. Signed-off-by: Martin Wilck <mwilck@suse.com> Reviewed-by: Keith Busch <kbusch@kernel.org> Signed-off-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/nvme')
-rw-r--r--drivers/nvme/host/multipath.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index a64dfff0d0ce..760f625cefc8 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -233,7 +233,7 @@ 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))
@@ -252,7 +252,7 @@ static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head,
goto out;
}
if (ns->ana_state == NVME_ANA_NONOPTIMIZED)
- fallback = ns;
+ found = ns;
}
/*
@@ -263,12 +263,11 @@ static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head,
*/
if (!nvme_path_is_disabled(old) &&
(old->ana_state == NVME_ANA_OPTIMIZED ||
- (!fallback && old->ana_state == NVME_ANA_NONOPTIMIZED)))
+ (!found && old->ana_state == NVME_ANA_NONOPTIMIZED)))
return old;
- if (!fallback)
+ if (!found)
return NULL;
- found = fallback;
out:
rcu_assign_pointer(head->current_path[node], found);
return found;