nvme/target: Change max_nsid in subsystem due to ns_disable if needed
Subsystems (2)
PATCH 1/1 nvme/target: Change max_nsid in subsystem due to ns_disable if needed
From: Roy Shterman <[email protected]>
In case we disable namespaces which has the nsid like subsystem max_nsid we need to search for the next largest nsid in this subsystem. If the subsystem don't has more namespaces we set it to 0, else we take nsid from the last namespace in namespaces list because the list is sorted while inserting.
--- drivers/nvme/target/core.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/nvme/target/core.c +11 -0
@@ -334,6 +334,17 @@ void nvmet_ns_disable(struct nvmet_ns *ns) ns->enabled = false;list_del_rcu (&ns->dev_link); + +if (ns->nsid == subsys->max_nsid) { +if (list_empty (&subsys->namespaces)) { + subsys->max_nsid =0 ; + }else { + struct nvmet_ns *ns = list_last_entry(&subsys->namespaces, struct nvmet_ns, entry); + + subsys->max_nsid = ns->nsid; + } + } +mutex_unlock (&subsys->lock);/*
Signature · 1 line
2.7.4
Sagi Grimberg
maintainerPATCH 1/1 nvme/target: Change max_nsid in subsystem due to ns_disable if needed
Looks good,
PATCH 1/1 nvme/target: Change max_nsid in subsystem due to ns_disable if needed
In reply to [email protected]Quoted 10 lines · On 10/10/2017 6:59 PM, [email protected] wrote:
From: Roy Shterman <roys at lightbitslabs.com>
In case we disable namespaces which has the nsid like subsystem
max_nsidwe need to search for the next largest nsid in this subsystem. If the subsystem don't has more namespaces we set it to 0, else we take nsid from the last namespace in namespaces list because the list is sorted while inserting.Signed-off-by Roy Shterman <roys at lightbitslabs.com>---
Looks good,
PATCH 1/1 nvme/target: Change max_nsid in subsystem due to ns_disable if needed
In reply to [email protected]Looks good and a reasonable 4.14. candidate.
PATCH 1/1 nvme/target: Change max_nsid in subsystem due to ns_disable if needed
In reply to [email protected]Actually, this doesn't even compile.. the entry in ->namespaces is dev_link, not entry.
If you resend please also fix the line > 80 chars, preferably by adding a new helper that returns the new max_nsid value.