nvmet: remove max_nsid calculation
Subsystems (2)
PATCH 1/1 nvmet: remove max_nsid calculation
From: Hannes Reinecke <[email protected]>
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 <[email protected]>
--- drivers/nvme/target/core.c | 18 ------------------ drivers/nvme/target/nvmet.h | 1 - 2 files changed, 19 deletions(-)
drivers/nvme/target/core.c +0 -18
@@ -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);
drivers/nvme/target/nvmet.h +0 -1
@@ -316,7 +316,6 @@ struct nvmet_subsys {struct xarray namespaces;unsigned int nr_namespaces; -u32 max_nsid;u16 cntlid_min;u16 cntlid_max;
Signature · 1 line
2.35.3