src/queue: never clear data->wait_nr

We're factoring in how many completions we have already, both in
liburing and in the kernel. Hence there's no need to ever clear
it, and in fact it causes issues with early return where we don't
have the required number of CQEs available.

While in there, get rid of the silly 'to_wait' variable.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/src/queue.c b/src/queue.c
index a688b43..ce5d237 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -89,7 +89,6 @@
 			     struct get_data *data)
 {
 	struct io_uring_cqe *cqe = NULL;
-	const int to_wait = data->wait_nr;
 	int err;
 
 	do {
@@ -102,7 +101,7 @@
 		err = __io_uring_peek_cqe(ring, &cqe, &nr_available);
 		if (err)
 			break;
-		if (!cqe && !to_wait && !data->submit) {
+		if (!cqe && !data->wait_nr && !data->submit) {
 			if (!cq_ring_needs_flush(ring)) {
 				err = -EAGAIN;
 				break;
@@ -129,16 +128,6 @@
 		}
 
 		data->submit -= ret;
-		if (!data->submit) {
-			/*
-			 * When SETUP_IOPOLL is set, __sys_io_uring enter()
-			 * must be called to reap new completions but the call
-			 * won't be made if both wait_nr and submit are zero
-			 * so preserve wait_nr.
-			 */
-			if (!(ring->flags & IORING_SETUP_IOPOLL))
-				data->wait_nr = 0;
-		}
 		if (cqe)
 			break;
 	} while (1);