summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2021-02-11 16:44:16 -0700
committerJens Axboe <axboe@kernel.dk>2021-02-11 16:44:57 -0700
commit10a9ff846dd62d2975f791c21731aafe1f8562bb (patch)
treeddc029c3fa25b004d96ce1edd6ebc9524401eacc
parent989d7cb34fe0661ef0ecf87dabc7e2d4423fbd60 (diff)
downloadliburing-10a9ff846dd62d2975f791c21731aafe1f8562bb.tar.gz
liburing-10a9ff846dd62d2975f791c21731aafe1f8562bb.tar.bz2
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>
-rw-r--r--src/queue.c13
1 files changed, 1 insertions, 12 deletions
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 @@ static int _io_uring_get_cqe(struct io_uring *ring, struct io_uring_cqe **cqe_pt
struct get_data *data)
{
struct io_uring_cqe *cqe = NULL;
- const int to_wait = data->wait_nr;
int err;
do {
@@ -102,7 +101,7 @@ static int _io_uring_get_cqe(struct io_uring *ring, struct io_uring_cqe **cqe_pt
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 @@ static int _io_uring_get_cqe(struct io_uring *ring, struct io_uring_cqe **cqe_pt
}
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);