Commit 84b7670d authored by GangCao's avatar GangCao Committed by Daniel Verkamp
Browse files

nvme: use spdk_zmalloc for IO qpair creation



Change-Id: I1a9b324605069b5fc1a5a7a23e87933ad3b2b3ca
Signed-off-by: default avatarGangCao <gang.cao@intel.com>
parent 8b449060
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1075,8 +1075,9 @@ nvme_ctrlr_destruct(struct spdk_nvme_ctrlr *ctrlr)
	while (!TAILQ_EMPTY(&ctrlr->active_io_qpairs)) {
		struct spdk_nvme_qpair *qpair = TAILQ_FIRST(&ctrlr->active_io_qpairs);

		spdk_nvme_ctrlr_free_io_qpair(qpair);
		nvme_qpair_destroy(qpair);

		spdk_nvme_ctrlr_free_io_qpair(qpair);
	}

	nvme_ctrlr_shutdown(ctrlr);
+5 −4
Original line number Diff line number Diff line
@@ -1154,7 +1154,7 @@ nvme_pcie_ctrlr_create_io_qpair(struct spdk_nvme_ctrlr *ctrlr, uint16_t qid,

	assert(ctrlr != NULL);

	pqpair = calloc(1, sizeof(*pqpair));
	pqpair = spdk_zmalloc(sizeof(*pqpair), 64, NULL);
	if (pqpair == NULL) {
		return NULL;
	}
@@ -1170,7 +1170,7 @@ nvme_pcie_ctrlr_create_io_qpair(struct spdk_nvme_ctrlr *ctrlr, uint16_t qid,

	rc = nvme_qpair_construct(qpair, qid, num_entries, ctrlr, qprio);
	if (rc != 0) {
		free(pqpair);
		spdk_free(pqpair);
		return NULL;
	}

@@ -1178,7 +1178,8 @@ nvme_pcie_ctrlr_create_io_qpair(struct spdk_nvme_ctrlr *ctrlr, uint16_t qid,

	if (rc != 0) {
		SPDK_ERRLOG("I/O queue creation failed\n");
		free(pqpair);
		nvme_qpair_destroy(qpair);
		spdk_free(pqpair);
		return NULL;
	}

@@ -1226,7 +1227,7 @@ nvme_pcie_ctrlr_delete_io_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_
		return -1;
	}

	free(pqpair);
	spdk_free(pqpair);

	return 0;
}