Commit cbbec6dd authored by Ziye Yang's avatar Ziye Yang Committed by Daniel Verkamp
Browse files

nvmf: make each io qpair recycled by its own thread



This patch selects part of commit:
adfa9f6d

In the previous patch, the failed reason is the logic
that admin qpair actively destroys the ioqpair when
the admin qpair is recevied early. For this part,
we need to investigate it later since for multiple core
usage in our current handling case, we possibly have
admin qpair firstly to enter the destruct phase even if
the initiator sends the I/O qpair deletion first. Thus,
the ioqpair deletion can be recycled twice.

And this patch is selecting the part of the logic:
only to make each ioqpair recycled by its own thread.

Change-Id: Ic9cc3fbdf56fa8a75cb5d12a16ce6c3129220bca
Signed-off-by: default avatarZiye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/409363


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 86ee572b
Loading
Loading
Loading
Loading
+27 −8
Original line number Diff line number Diff line
@@ -274,6 +274,32 @@ end:
	spdk_thread_send_msg(qpair->group->thread, _spdk_nvmf_request_complete, req);
}

static void
_ctrlr_destruct_check(void *ctx)
{
	struct spdk_nvmf_ctrlr *ctrlr = ctx;

	assert(ctrlr != NULL);
	assert(ctrlr->num_qpairs > 0);
	ctrlr->num_qpairs--;
	if (ctrlr->num_qpairs == 0) {
		assert(ctrlr->subsys != NULL);
		assert(ctrlr->subsys->thread != NULL);
		spdk_thread_send_msg(ctrlr->subsys->thread, ctrlr_destruct, ctrlr);
	}
}

static void
nvmf_qpair_fini(void *ctx)
{
	struct spdk_nvmf_qpair *qpair = ctx;
	struct spdk_nvmf_ctrlr *ctrlr = qpair->ctrlr;
	struct spdk_thread *admin_thread = ctrlr->admin_qpair->group->thread;

	spdk_nvmf_transport_qpair_fini(qpair);
	spdk_thread_send_msg(admin_thread, _ctrlr_destruct_check, ctrlr);
}

static void
ctrlr_delete_qpair(void *ctx)
{
@@ -288,15 +314,8 @@ ctrlr_delete_qpair(void *ctx)
		return;
	}

	ctrlr->num_qpairs--;
	TAILQ_REMOVE(&ctrlr->qpairs, qpair, link);
	spdk_nvmf_transport_qpair_fini(qpair);

	if (ctrlr->num_qpairs == 0) {
		assert(ctrlr->subsys != NULL);
		assert(ctrlr->subsys->thread != NULL);
		spdk_thread_send_msg(ctrlr->subsys->thread, ctrlr_destruct, ctrlr);
	}
	spdk_thread_send_msg(qpair->group->thread, nvmf_qpair_fini, qpair);
}

static void