Commit 8d424e6e authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

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: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent e098976c
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -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;