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: Changpeng Liu <changpeng.liu@intel.com> Reviewed-on: https://review.gerrithub.io/412604 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
1fd0107026
commit
967339f3e5
@ -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;
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
||||
|
@ -115,6 +115,12 @@ nvme_qpair_init(struct spdk_nvme_qpair *qpair, uint16_t id,
|
||||
abort();
|
||||
}
|
||||
|
||||
void
|
||||
nvme_qpair_deinit(struct spdk_nvme_qpair *qpair)
|
||||
{
|
||||
abort();
|
||||
}
|
||||
|
||||
int
|
||||
spdk_pci_nvme_enumerate(spdk_pci_enum_cb enum_cb, void *enum_ctx)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user