idxd: Rearrange logic in spdk_idxd_process_events

If we don't find a completion, break out of the loop at the top. This
removes a level of indentation but most importantly makes it very clear
that we only remove elements from ops_outstanding from the front of the
list.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: I5e8784a5af5449c14ff7015bc8e6062e6aee6b4e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12257
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Dong Yi <dongx.yi@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
This commit is contained in:
Ben Walker 2022-04-12 14:49:36 -07:00 committed by Tomasz Zawadzki
parent da744fc9e0
commit 863200c7d4

View File

@ -1267,7 +1267,14 @@ spdk_idxd_process_events(struct spdk_idxd_io_channel *chan)
assert(chan != NULL); assert(chan != NULL);
TAILQ_FOREACH_SAFE(op, &chan->ops_outstanding, link, tmp) { TAILQ_FOREACH_SAFE(op, &chan->ops_outstanding, link, tmp) {
if (IDXD_COMPLETION(op->hw.status)) { if (!IDXD_COMPLETION(op->hw.status)) {
/*
* oldest locations are at the head of the list so if
* we've polled a location that hasn't completed, bail
* now as there are unlikely to be any more completions.
*/
break;
}
TAILQ_REMOVE(&chan->ops_outstanding, op, link); TAILQ_REMOVE(&chan->ops_outstanding, op, link);
rc++; rc++;
@ -1311,14 +1318,6 @@ spdk_idxd_process_events(struct spdk_idxd_io_channel *chan)
/* reset the status */ /* reset the status */
status = 0; status = 0;
} else {
/*
* oldest locations are at the head of the list so if
* we've polled a location that hasn't completed, bail
* now as there are unlikely to be any more completions.
*/
break;
}
} }
/* Submit any built-up batch */ /* Submit any built-up batch */