nvme: put req in nvme_tcp_req_complete

All callers of nvme_tcp_req_complete call
nvme_tcp_req_put immediately afterwards, so move
this call into nvme_tcp_req_complete.

This will help enable some improvements in later
patches.

Note that nvme_tcp_req_complete_safe has this same
functionality open coded right now, but that will
get changed in the next patch.  It calls
nvme_tcp_req_put immediately after the TAILQ_REMOVE,
so do that in nvme_tcp_req_complete as well.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I368122bc49a7f0772e3011e5427e3c43618380eb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13520
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
This commit is contained in:
Jim Harris 2022-06-30 20:10:43 +00:00 committed by Tomasz Zawadzki
parent 0989766060
commit d1179a5801

View File

@ -758,6 +758,7 @@ nvme_tcp_qpair_reset(struct spdk_nvme_qpair *qpair)
static void
nvme_tcp_req_complete(struct nvme_tcp_req *tcp_req,
struct nvme_tcp_qpair *tqpair,
struct spdk_nvme_cpl *rsp)
{
struct nvme_request *req;
@ -766,6 +767,7 @@ nvme_tcp_req_complete(struct nvme_tcp_req *tcp_req,
req = tcp_req->req;
TAILQ_REMOVE(&tcp_req->tqpair->outstanding_reqs, tcp_req, link);
nvme_tcp_req_put(tqpair, tcp_req);
nvme_complete_request(req->cb_fn, req->cb_arg, req->qpair, req, rsp);
nvme_free_request(req);
}
@ -782,8 +784,7 @@ nvme_tcp_qpair_abort_reqs(struct spdk_nvme_qpair *qpair, uint32_t dnr)
cpl.status.dnr = dnr;
TAILQ_FOREACH_SAFE(tcp_req, &tqpair->outstanding_reqs, link, tmp) {
nvme_tcp_req_complete(tcp_req, &cpl);
nvme_tcp_req_put(tqpair, tcp_req);
nvme_tcp_req_complete(tcp_req, tqpair, &cpl);
}
}
@ -2201,8 +2202,7 @@ nvme_tcp_admin_qpair_abort_aers(struct spdk_nvme_qpair *qpair)
continue;
}
nvme_tcp_req_complete(tcp_req, &cpl);
nvme_tcp_req_put(tqpair, tcp_req);
nvme_tcp_req_complete(tcp_req, tqpair, &cpl);
}
}