Handle short read at the end of file
Currently we don't issue an io operation if offset + buflen
is larger than the file size, but that means we don't reach
the last bit of a file if the size isn't block size aligned.
Instead handle a short read properly. It actually cleans up
the code as well.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/fio.c b/fio.c
index 2f0d740..ef63ce6 100644
--- a/fio.c
+++ b/fio.c
@@ -452,8 +452,14 @@
io_u->xfer_buflen = io_u->resid;
io_u->xfer_buf += bytes;
+ io_u->offset += bytes;
+
+ if (io_u->offset == io_u->file->real_file_size)
+ goto sync_done;
+
requeue_io_u(td, &io_u);
} else {
+sync_done:
fio_gettime(&comp_time, NULL);
bytes_done = io_u_sync_complete(td, io_u);
if (bytes_done < 0)