Commit 967339f3 authored by Changpeng Liu's avatar Changpeng Liu
Browse files

nvme: factor out qpair destruction function



Factor qpair destruction function so that we can put common
resource release together in future.

Change-Id: I44139947820c2a384b745ae2673799f1b736369c
Signed-off-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/412604


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 1fd01070
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -295,7 +295,6 @@ int
spdk_nvme_ctrlr_free_io_qpair(struct spdk_nvme_qpair *qpair)
{
	struct spdk_nvme_ctrlr *ctrlr;
	void *req_buf;

	if (qpair == NULL) {
		return 0;
@@ -321,15 +320,11 @@ spdk_nvme_ctrlr_free_io_qpair(struct spdk_nvme_qpair *qpair)
	TAILQ_REMOVE(&ctrlr->active_io_qpairs, qpair, tailq);
	spdk_bit_array_set(ctrlr->free_io_qids, qpair->id);

	req_buf = qpair->req_buf;

	if (nvme_transport_ctrlr_delete_io_qpair(ctrlr, qpair)) {
		nvme_robust_mutex_unlock(&ctrlr->ctrlr_lock);
		return -1;
	}

	spdk_dma_free(req_buf);

	nvme_robust_mutex_unlock(&ctrlr->ctrlr_lock);
	return 0;
}
+1 −0
Original line number Diff line number Diff line
@@ -647,6 +647,7 @@ int nvme_qpair_init(struct spdk_nvme_qpair *qpair, uint16_t id,
			struct spdk_nvme_ctrlr *ctrlr,
			enum spdk_nvme_qprio qprio,
			uint32_t num_requests);
void	nvme_qpair_deinit(struct spdk_nvme_qpair *qpair);
void	nvme_qpair_enable(struct spdk_nvme_qpair *qpair);
void	nvme_qpair_disable(struct spdk_nvme_qpair *qpair);
int	nvme_qpair_submit_request(struct spdk_nvme_qpair *qpair,
+2 −0
Original line number Diff line number Diff line
@@ -1336,6 +1336,8 @@ nvme_pcie_qpair_destroy(struct spdk_nvme_qpair *qpair)
		spdk_dma_free(pqpair->tr);
	}

	nvme_qpair_deinit(qpair);

	spdk_dma_free(pqpair);

	return 0;
+6 −0
Original line number Diff line number Diff line
@@ -412,6 +412,12 @@ nvme_qpair_init(struct spdk_nvme_qpair *qpair, uint16_t id,
	return 0;
}

void
nvme_qpair_deinit(struct spdk_nvme_qpair *qpair)
{
	spdk_dma_free(qpair->req_buf);
}

int
nvme_qpair_submit_request(struct spdk_nvme_qpair *qpair, struct nvme_request *req)
{
+1 −0
Original line number Diff line number Diff line
@@ -1110,6 +1110,7 @@ nvme_rdma_qpair_destroy(struct spdk_nvme_qpair *qpair)
	if (!qpair) {
		return -1;
	}
	nvme_qpair_deinit(qpair);

	rqpair = nvme_rdma_qpair(qpair);

Loading