nvme: use spdk_zmalloc for IO qpair creation

Change-Id: I1a9b324605069b5fc1a5a7a23e87933ad3b2b3ca
Signed-off-by: GangCao <gang.cao@intel.com>
This commit is contained in:
GangCao 2016-11-07 01:35:48 -05:00 committed by Daniel Verkamp
parent 8b449060eb
commit 84b7670dff
2 changed files with 7 additions and 5 deletions

View File

@ -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);

View File

@ -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;
}