public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH liburing 2/3] src/queue: clean _io_uring_get_cqe() err handling
Date: Sun,  7 Feb 2021 23:32:16 +0000	[thread overview]
Message-ID: <3901e2c04937f30b95b1126929611338c2ac4885.1612740655.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>

Doesn't change behaviour, just a little cleanup.

Signed-off-by: Pavel Begunkov <[email protected]>
---
 src/queue.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/queue.c b/src/queue.c
index dd1df2a..be461c6 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -117,8 +117,11 @@ static int _io_uring_get_cqe(struct io_uring *ring, struct io_uring_cqe **cqe_pt
 					data->sz);
 		if (ret < 0) {
 			err = -errno;
-		} else if (ret == (int)data->submit) {
-			data->submit = 0;
+			break;
+		}
+
+		data->submit -= ret;
+		if (ret == (int)data->submit) {
 			/*
 			 * When SETUP_IOPOLL is set, __sys_io_uring enter()
 			 * must be called to reap new completions but the call
@@ -127,12 +130,10 @@ static int _io_uring_get_cqe(struct io_uring *ring, struct io_uring_cqe **cqe_pt
 			 */
 			if (!(ring->flags & IORING_SETUP_IOPOLL))
 				data->wait_nr = 0;
-		} else {
-			data->submit -= ret;
 		}
 		if (cqe)
 			break;
-	} while (!err);
+	} while (1);
 
 	*cqe_ptr = cqe;
 	return err;
-- 
2.24.0


  parent reply	other threads:[~2021-02-07 23:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-07 23:32 [PATCH liburing 0/3] fix _io_uring_get_cqe() Pavel Begunkov
2021-02-07 23:32 ` [PATCH liburing 1/3] src/queue: don't wait for less than expected Pavel Begunkov
2021-02-07 23:32 ` Pavel Begunkov [this message]
2021-02-07 23:32 ` [PATCH liburing 3/3] src/queue: don't loop when don't enter Pavel Begunkov
2021-02-08 15:26 ` [PATCH liburing 0/3] fix _io_uring_get_cqe() Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3901e2c04937f30b95b1126929611338c2ac4885.1612740655.git.asml.silence@gmail.com \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox