From: William Dauchy <[email protected]>
To: [email protected]
Subject: io_uring_peek_cqe and EAGAIN
Date: Mon, 20 Apr 2020 18:27:48 +0200 [thread overview]
Message-ID: <20200420162748.GA43918@dontpanic> (raw)
Hello,
While doing some tests which are open/read/close files I saw that I
was getting -EAGAIN return value sometimesi on io_uring_peek_cqe,
and more often after dropping caches.
In parrallel, when reading examples provided by liburing, we can see
that getting this error is making the example fail (such as in
io_uring-cp). So I was wondering whether it was stupid to change the
example to something like:
diff --git a/examples/io_uring-cp.c b/examples/io_uring-cp.c
index cc7a227..2d6d190 100644
--- a/examples/io_uring-cp.c
+++ b/examples/io_uring-cp.c
@@ -170,11 +170,11 @@ static int copy_file(struct io_uring *ring, off_t insize)
ret = io_uring_wait_cqe(ring, &cqe);
got_comp = 1;
} else {
- ret = io_uring_peek_cqe(ring, &cqe);
- if (ret == -EAGAIN) {
- cqe = NULL;
- ret = 0;
- }
+ do {
+ ret = io_uring_peek_cqe(ring, &cqe)
+ if (ret != -EAGAIN)
+ break;
+ } while (1);
}
if (ret < 0) {
fprintf(stderr, "io_uring_peek_cqe: %s\n",
Best,
--
William
next reply other threads:[~2020-04-20 16:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-20 16:27 William Dauchy [this message]
2020-04-22 20:57 ` io_uring_peek_cqe and EAGAIN Jens Axboe
2020-04-23 14:42 ` William Dauchy
2020-04-23 15:05 ` Jens Axboe
2020-04-23 15:12 ` William Dauchy
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=20200420162748.GA43918@dontpanic \
[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