Commit 2d224c0d authored by Jim Harris's avatar Jim Harris
Browse files

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: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: Idef44accc69dccb9d161b8f04b9d5d3bbbf9e037

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469285


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent dc6c3e08
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -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;
	}