From: Jens Axboe Date: Tue, 11 Aug 2020 02:54:46 +0000 (-0600) Subject: io_uring: notice short IO on completion path X-Git-Tag: fio-3.22~12 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=7d33649cc0b6a887cb2e89e5ef2632e21529f4ec 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 --- 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;