backend: count iterative bytes for progress
authorJens Axboe <axboe@fb.com>
Sat, 19 Dec 2015 05:33:35 +0000 (22:33 -0700)
committerJens Axboe <axboe@fb.com>
Sat, 19 Dec 2015 05:33:35 +0000 (22:33 -0700)
Commit ac28d9053679 changed it so we don't clear ->bytes_done[]
necessarily for each loop. However, this introduced a busy loop
where we this we did IO and continue to loop, but we really
didn't.

Fixes: ac28d9053679 ("Fixup bw/iops logging for short runs")
Signed-off-by: Jens Axboe <axboe@fb.com>
backend.c

index c9875f480c726ec814ed916d02491a4dce442faf..89ac76b379813284648d83763aa63b101328ae88 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -813,6 +813,10 @@ static uint64_t do_io(struct thread_data *td)
        unsigned int i;
        int ret = 0;
        uint64_t total_bytes, bytes_issued = 0;
+       uint64_t this_bytes[2];
+
+       this_bytes[0] = td->bytes_done[DDIR_WRITE];
+       this_bytes[1] = td->bytes_done[DDIR_TRIM];
 
        if (in_ramp_time(td))
                td_set_runstate(td, TD_RAMP);
@@ -1046,7 +1050,8 @@ reap:
        if (!ddir_rw_sum(td->this_io_bytes))
                td->done = 1;
 
-       return td->bytes_done[DDIR_WRITE] + td->bytes_done[DDIR_TRIM];
+       return (td->bytes_done[DDIR_WRITE] - this_bytes[0]) +
+               (td->bytes_done[DDIR_TRIM] - this_bytes[1]);
 }
 
 static void cleanup_io_u(struct thread_data *td)