[PATCH 2/3] nvme/multipath: cosmetic: keep ns nsid locally
Anton Eidelman
anton.eidelman at gmail.com
Sun Sep 12 11:54:58 PDT 2021
Keep the nsid of the current namespace in a local variable.
Change the type to unsigned int to make checkpatch happy.
Signed-off-by: Anton Eidelman <anton at lightbitslabs.com>
---
drivers/nvme/host/multipath.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index e8ccdd398f78..a51561d67b93 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -600,16 +600,18 @@ 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 int nsid;
+ unsigned int 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