Commit 863200c7 authored by Ben Walker's avatar Ben Walker Committed by Tomasz Zawadzki
Browse files

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: default avatarBen 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: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarDong Yi <dongx.yi@intel.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
parent da744fc9
Loading
Loading
Loading
Loading
+43 −44
Original line number Diff line number Diff line
@@ -1267,7 +1267,14 @@ spdk_idxd_process_events(struct spdk_idxd_io_channel *chan)
	assert(chan != NULL);

	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);
		rc++;
@@ -1311,14 +1318,6 @@ spdk_idxd_process_events(struct spdk_idxd_io_channel *chan)

		/* reset the status */
		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 */