io_u: calculate incremental residuals correctly
authorJens Axboe <axboe@kernel.dk>
Wed, 12 Aug 2020 17:48:15 +0000 (11:48 -0600)
committerJens Axboe <axboe@kernel.dk>
Wed, 12 Aug 2020 17:48:15 +0000 (11:48 -0600)
We need to use the transfer buffer length for the residual calculation,
otherwise multiple shorts on the same IO will not calculate the right
value.

Fixes: 5fff95436922 ("Add support for >= 4G block sizes")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_u.c

diff --git a/io_u.c b/io_u.c
index dbb0a6f851b7bfa84d1f1d8188af63caf0b1b814..2ef5acec95fe798bd4a657e4936414ea84593efd 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -1977,7 +1977,7 @@ static void io_completed(struct thread_data *td, struct io_u **io_u_ptr,
        td->last_ddir = ddir;
 
        if (!io_u->error && ddir_rw(ddir)) {
-               unsigned long long bytes = io_u->buflen - io_u->resid;
+               unsigned long long bytes = io_u->xfer_buflen - io_u->resid;
                int ret;
 
                /*