nvme/rdma: simplify nvme_rdma_req_get()

nvme_rdma_req_get() is an internal function, and its only caller already
checks for a valid rqpair, so the NULL check is unnecessary.

Also clean up the redundant STAILQ_EMPTY/STAILQ_FIRST logic and use
STAILQ_REMOVE_HEAD.

Change-Id: Ic3828e8b5e881879173cb59350e39c5fac90e6ef
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-11-28 14:28:40 -07:00
parent 9c2186ea65
commit 11a2f1cf47

View File

@ -144,12 +144,10 @@ nvme_rdma_req_get(struct nvme_rdma_qpair *rqpair)
{
struct spdk_nvme_rdma_req *rdma_req;
if (!rqpair || STAILQ_EMPTY(&rqpair->free_reqs)) {
return NULL;
}
rdma_req = STAILQ_FIRST(&rqpair->free_reqs);
STAILQ_REMOVE(&rqpair->free_reqs, rdma_req, spdk_nvme_rdma_req, link);
if (rdma_req) {
STAILQ_REMOVE_HEAD(&rqpair->free_reqs, link);
}
return rdma_req;
}