Commit 848e9e2d authored by Seth Howell's avatar Seth Howell Committed by Tomasz Zawadzki
Browse files

lib/nvmf: modify subsystem_state_change.



If we are already in the desired state,
just call the callback directly from the
subsystem_state_change function. That way
we save a lot of message passing.

Signed-off-by: default avatarSeth Howell <seth.howell@intel.com>
Change-Id: I6cf8563524610d9125d53266e3c0e179e064bf63
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3760


Community-CI: Broadcom CI
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
parent 8ff8bf07
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -575,6 +575,15 @@ nvmf_subsystem_state_change(struct spdk_nvmf_subsystem *subsystem,
		return -EBUSY;
	}

	/* If we are already in the requested state, just call the callback immediately. */
	if (subsystem->state == requested_state) {
		subsystem->changing_state = false;
		if (cb_fn) {
			cb_fn(subsystem, cb_arg, 0);
		}
		return 0;
	}

	intermediate_state = nvmf_subsystem_get_intermediate_state(subsystem->state, requested_state);
	assert(intermediate_state != SPDK_NVMF_SUBSYSTEM_NUM_STATES);