summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2020-08-10 20:54:46 -0600
committerJens Axboe <axboe@kernel.dk>2020-08-10 20:54:46 -0600
commit7d33649cc0b6a887cb2e89e5ef2632e21529f4ec (patch)
treeb208de1afb5e77ab62455e6e824b2791c13cccaf
parentbba6b14f3588fd21e6181c0c9194d8f95533aff6 (diff)
downloadfio-7d33649cc0b6a887cb2e89e5ef2632e21529f4ec.tar.gz
fio-7d33649cc0b6a887cb2e89e5ef2632e21529f4ec.tar.bz2
io_uring: notice short IO on completion path
Async IO engines need to signal residual from the completion path, but we completely ignore those. Ensure we properly requeue IO that was short, after adjusting the state. Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--io_u.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/io_u.c b/io_u.c
index 667530c0..63a42f9f 100644
--- a/io_u.c
+++ b/io_u.c
@@ -1977,6 +1977,21 @@ static void io_completed(struct thread_data *td, struct io_u **io_u_ptr,
unsigned long long bytes = io_u->buflen - io_u->resid;
int ret;
+ /*
+ * Make sure we notice short IO from here, and requeue them
+ * appropriately!
+ */
+ if (io_u->resid) {
+ io_u->xfer_buflen = io_u->resid;
+ io_u->xfer_buf += bytes;
+ io_u->offset += bytes;
+ td->ts.short_io_u[io_u->ddir]++;
+ if (io_u->offset < io_u->file->real_file_size) {
+ requeue_io_u(td, io_u_ptr);
+ return;
+ }
+ }
+
td->io_blocks[ddir]++;
td->io_bytes[ddir] += bytes;