Commit 8d394797 authored by Changpeng Liu's avatar Changpeng Liu Committed by Ben Walker
Browse files

spdk_dd: simplify `io_uring_peek_cqe` return code processing



`io_uring_peek_cqe` will only return `-EAGAIN` as an error, or
there is a valid CQE entry, then we can check `cqe->res` for
further processing.  Also return correct value for pollers.

Change-Id: If82744291b1b0bf42cb1cf2d9ab1524732ff8b40
Signed-off-by: default avatarChangpeng Liu <changpeliu@tencent.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/25486


Community-CI: Mellanox Build Bot
Reviewed-by: default avatarJim Harris <jim.harris@nvidia.com>
Community-CI: Community CI Samsung <spdk.community.ci.samsung@gmail.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarGangCao <gang.cao@intel.com>
Reviewed-by: default avatarBen Walker <ben@nvidia.com>
parent 77ee034c
Loading
Loading
Loading
Loading
+14 −16
Original line number Diff line number Diff line
@@ -810,26 +810,24 @@ dd_uring_poll(void *ctx)

	for (i = 0; i < (int)g_opts.queue_depth; i++) {
		rc = io_uring_peek_cqe(&g_job.u.uring.ring, &cqe);
		if (rc == 0) {
			if (cqe->res == -EAGAIN) {
				continue;
			} else if (cqe->res < 0) {
				SPDK_ERRLOG("%s\n", strerror(-cqe->res));
				g_error = cqe->res;
		if (rc == -EAGAIN) {
			break;
		}
		assert(cqe != NULL);

		io = io_uring_cqe_get_data(cqe);
			io_uring_cqe_seen(&g_job.u.uring.ring, cqe);
		if (cqe->res < 0) {
			SPDK_ERRLOG("%s\n", strerror(-cqe->res));
			dd_exit(cqe->res);
		}

		io_uring_cqe_seen(&g_job.u.uring.ring, cqe);
		dd_complete_poll(io);
		} else if (rc != - EAGAIN) {
			SPDK_ERRLOG("%s\n", strerror(-rc));
			g_error = rc;
		}
	}

	return rc;
	return (i ? SPDK_POLLER_BUSY : SPDK_POLLER_IDLE);
}

#endif

static int
@@ -860,7 +858,7 @@ dd_aio_poll(void *ctx)
		dd_complete_poll(io);
	}

	return rc;
	return (i ? SPDK_POLLER_BUSY : SPDK_POLLER_IDLE);
}

static int