io_uring/rw: allow pollable non-blocking attempts for !FMODE_NOWAIT
authorJens Axboe <axboe@kernel.dk>
Sun, 6 Oct 2024 16:40:36 +0000 (10:40 -0600)
committerJens Axboe <axboe@kernel.dk>
Mon, 7 Oct 2024 02:58:53 +0000 (20:58 -0600)
commitf7c9134385331c5ef36252895130aa01a92de907
tree3c2cde2962ca2d67fc46ae7197fb87e4b622767e
parentc9d952b9103b600ddafc5d1c0e2f2dbd30f0b805
io_uring/rw: allow pollable non-blocking attempts for !FMODE_NOWAIT

The checking for whether or not io_uring can do a non-blocking read or
write attempt is gated on FMODE_NOWAIT. However, if the file is
pollable, it's feasible to just check if it's currently in a state in
which it can sanely receive or send _some_ data.

This avoids unnecessary io-wq punts, and repeated worthless retries
before doing that punt, by assuming that some data can get delivered
or received if poll tells us that is true. It also allows multishot
reads to properly work with these types of files, enabling a bit of
a cleanup of the logic that:

c9d952b9103b ("io_uring/rw: fix cflags posting for single issue multishot read")

had to put in place.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/rw.c