nvme: simplify logic for whether to call callback

No change in behavior, just a simplification.

We already have a check for retry, so pull the cb_fn check out and put
it under the !retry branch.

This makes it clearer that requests that are going to be retried will
not get their callbacks called.

Change-Id: I70c7067e550c7fca78b0441b5474833f73863315
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2015-09-24 14:53:42 -07:00
parent e098976c55
commit 8d424e6e71

View File

@ -317,14 +317,14 @@ nvme_qpair_complete_tracker(struct nvme_qpair *qpair, struct nvme_tracker *tr,
nvme_assert(cpl->cid == req->cmd.cid, ("cpl cid does not match cmd cid\n"));
if (req->cb_fn && !retry) {
req->cb_fn(req->cb_arg, cpl);
}
if (retry) {
req->retries++;
nvme_qpair_submit_tracker(qpair, tr);
} else {
if (req->cb_fn) {
req->cb_fn(req->cb_arg, cpl);
}
nvme_free_request(req);
tr->req = NULL;