nvmf: simplify spdk_nvmf_subsystem_remove_ns

With this change we only check the subsystem state once.
Previously it did it twice, and with a different order
(once PAUSED || INACTIVE, the other INACTIVE || PAUSED).

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Idef44accc69dccb9d161b8f04b9d5d3bbbf9e037

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469285
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Jim Harris 2019-09-24 07:23:39 -07:00
parent dc6c3e08fb
commit 2d224c0d60

View File

@ -899,15 +899,13 @@ spdk_nvmf_subsystem_remove_ns(struct spdk_nvmf_subsystem *subsystem, uint32_t ns
struct spdk_nvmf_ns *ns;
struct spdk_nvmf_registrant *reg, *reg_tmp;
assert(subsystem->state == SPDK_NVMF_SUBSYSTEM_PAUSED ||
subsystem->state == SPDK_NVMF_SUBSYSTEM_INACTIVE);
if (nsid == 0 || nsid > subsystem->max_nsid) {
if (!(subsystem->state == SPDK_NVMF_SUBSYSTEM_INACTIVE ||
subsystem->state == SPDK_NVMF_SUBSYSTEM_PAUSED)) {
assert(false);
return -1;
}
if (!(subsystem->state == SPDK_NVMF_SUBSYSTEM_INACTIVE ||
subsystem->state == SPDK_NVMF_SUBSYSTEM_PAUSED)) {
if (nsid == 0 || nsid > subsystem->max_nsid) {
return -1;
}