Commit b625b3d6 authored by Konrad Sztyber's avatar Konrad Sztyber Committed by Jim Harris
Browse files

nvmf: remove subsystem->changing_state



Now that we're keeping state change requests on a queue, we don't need
this variable anymore.

Signed-off-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I6715900c218bab8776716814e07c37e64eeecfef
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/22943


Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
parent 2881f7f6
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -285,9 +285,6 @@ struct spdk_nvmf_subsystem {
		uint8_t					reserved : 5;
	} flags;

	/* boolean for state change synchronization */
	bool						changing_state;

	bool						destroying;
	bool						async_destroy;

+2 −11
Original line number Diff line number Diff line
@@ -586,9 +586,6 @@ _nvmf_subsystem_state_change_complete(void *_ctx)
	assert(TAILQ_FIRST(&subsystem->state_changes) == ctx);
	TAILQ_REMOVE(&subsystem->state_changes, ctx, link);
	next = TAILQ_FIRST(&subsystem->state_changes);
	if (next == NULL) {
		subsystem->changing_state = false;
	}
	pthread_mutex_unlock(&subsystem->mutex);

	if (ctx->cb_fn != NULL) {
@@ -746,7 +743,7 @@ nvmf_subsystem_state_change(struct spdk_nvmf_subsystem *subsystem,
			    spdk_nvmf_subsystem_state_change_done cb_fn,
			    void *cb_arg)
{
	struct nvmf_subsystem_state_change_ctx *ctx, *prev __attribute__((unused));
	struct nvmf_subsystem_state_change_ctx *ctx;
	struct spdk_thread *thread;

	thread = spdk_get_thread();
@@ -767,17 +764,11 @@ nvmf_subsystem_state_change(struct spdk_nvmf_subsystem *subsystem,
	ctx->thread = thread;

	pthread_mutex_lock(&subsystem->mutex);
	prev = TAILQ_FIRST(&subsystem->state_changes);
	TAILQ_INSERT_TAIL(&subsystem->state_changes, ctx, link);

	if (subsystem->changing_state) {
		assert(prev != NULL);
	if (ctx != TAILQ_FIRST(&subsystem->state_changes)) {
		pthread_mutex_unlock(&subsystem->mutex);
		return 0;
	}

	assert(prev == NULL);
	subsystem->changing_state = true;
	pthread_mutex_unlock(&subsystem->mutex);

	nvmf_subsystem_do_state_change(ctx);