nvme: add nvme_free_request() variant that takes qpair

This avoids dereferencing the request to get the qpair
in cases where we already know the qpair.  Adding a new
variant instead of just modifying nvme_free_request()
since there are 72 calls to this function and I don't
want to change all of them.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ifd6fd964e546bcd71ff180fd71d5bf5cbab79d4f

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455287
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Jim Harris 2019-05-21 03:12:31 -07:00
parent ef1f844395
commit 37184dd471
2 changed files with 10 additions and 1 deletions

View File

@ -960,6 +960,15 @@ nvme_free_request(struct nvme_request *req)
STAILQ_INSERT_HEAD(&req->qpair->free_req, req, stailq);
}
static inline void
nvme_qpair_free_request(struct spdk_nvme_qpair *qpair, struct nvme_request *req)
{
assert(req != NULL);
assert(req->num_children == 0);
STAILQ_INSERT_HEAD(&qpair->free_req, req, stailq);
}
void nvme_request_remove_child(struct nvme_request *parent, struct nvme_request *child);
int nvme_request_check_timeout(struct nvme_request *req, uint16_t cid,
struct spdk_nvme_ctrlr_process *active_proc, uint64_t now_tick);

View File

@ -1316,7 +1316,7 @@ nvme_pcie_qpair_complete_tracker(struct spdk_nvme_qpair *qpair, struct nvme_trac
}
if (req_from_current_proc == true) {
nvme_free_request(req);
nvme_qpair_free_request(qpair, req);
}
tr->req = NULL;