[PATCH v3 2/3] nvme/multipath: cosmetic: keep ns nsid locally
Anton Eidelman
anton.eidelman at gmail.com
Mon Sep 13 14:46:31 PDT 2021
Keep the nsid of the current namespace in a local variable,
in order to avoid multiple occurrances of "ns->head->ns_id".
Signed-off-by: Anton Eidelman <anton at lightbitslabs.com>
---
drivers/nvme/host/multipath.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index e8ccdd398f78..e1ce80c12815 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -601,15 +601,17 @@ static int nvme_update_ana_state(struct nvme_ctrl *ctrl,
down_read(&ctrl->namespaces_rwsem);
list_for_each_entry(ns, &ctrl->namespaces, list) {
unsigned nsid;
+ unsigned ns_nsid = ns->head->ns_id;
+
again:
nsid = le32_to_cpu(desc->nsids[n]);
- if (ns->head->ns_id < nsid)
+ if (ns_nsid < nsid)
continue;
- if (ns->head->ns_id == nsid)
+ if (ns_nsid == nsid)
nvme_update_ns_ana_state(desc, ns);
if (++n == nr_nsids)
break;
- if (ns->head->ns_id > nsid)
+ if (ns_nsid > nsid)
goto again;
}
up_read(&ctrl->namespaces_rwsem);
--
2.25.1
More information about the Linux-nvme
mailing list