From: hare@kernel.org
To: Christoph Hellwig <hch@lst.de>
Cc: Keith Busch <kbusch@kernel.org>, Sagi Grimberg <sagi@grimberg.me>,
linux-nvme@lists.infradead.org, Hannes Reinecke <hare@kernel.org>
Subject: [PATCH] nvmet: remove max_nsid calculation
Date: Fri, 24 Jan 2025 08:14:14 +0100 [thread overview]
Message-ID: <20250124071414.104643-1-hare@kernel.org> (raw)
From: Hannes Reinecke <hare@kernel.org>
We never look at the 'max_nsid' value, and it's questionable
whether it is even calculated correctly. So remove it.
Signed-off-by: Hannes Reinecke <hare@kernel.org>
---
drivers/nvme/target/core.c | 18 ------------------
drivers/nvme/target/nvmet.h | 1 -
2 files changed, 19 deletions(-)
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index a058f473652c..78ba6162361a 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -121,18 +121,6 @@ u16 nvmet_zero_sgl(struct nvmet_req *req, off_t off, size_t len)
return 0;
}
-static u32 nvmet_max_nsid(struct nvmet_subsys *subsys)
-{
- struct nvmet_ns *cur;
- unsigned long idx;
- u32 nsid = 0;
-
- nvmet_for_each_enabled_ns(&subsys->namespaces, idx, cur)
- nsid = cur->nsid;
-
- return nsid;
-}
-
static u32 nvmet_async_event_result(struct nvmet_async_event *aen)
{
return aen->event_type | (aen->event_info << 8) | (aen->log_page << 16);
@@ -657,8 +645,6 @@ void nvmet_ns_free(struct nvmet_ns *ns)
mutex_lock(&subsys->lock);
xa_erase(&subsys->namespaces, ns->nsid);
- if (ns->nsid == subsys->max_nsid)
- subsys->max_nsid = nvmet_max_nsid(subsys);
mutex_unlock(&subsys->lock);
@@ -708,9 +694,6 @@ struct nvmet_ns *nvmet_ns_alloc(struct nvmet_subsys *subsys, u32 nsid)
if (percpu_ref_init(&ns->ref, nvmet_destroy_namespace, 0, GFP_KERNEL))
goto out_free;
- if (ns->nsid > subsys->max_nsid)
- subsys->max_nsid = nsid;
-
if (xa_insert(&subsys->namespaces, ns->nsid, ns, GFP_KERNEL))
goto out_exit;
@@ -729,7 +712,6 @@ struct nvmet_ns *nvmet_ns_alloc(struct nvmet_subsys *subsys, u32 nsid)
return ns;
out_exit:
- subsys->max_nsid = nvmet_max_nsid(subsys);
percpu_ref_exit(&ns->ref);
out_free:
kfree(ns);
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
index 62a554b00951..4dc7ba5d02a7 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h
@@ -316,7 +316,6 @@ struct nvmet_subsys {
struct xarray namespaces;
unsigned int nr_namespaces;
- u32 max_nsid;
u16 cntlid_min;
u16 cntlid_max;
--
2.35.3
reply other threads:[~2025-01-24 7:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20250124071414.104643-1-hare@kernel.org \
--to=hare@kernel.org \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--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