From 70c6807675291c2c5ccb38cc9c81b45bcaed0ce1 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 18 Dec 2015 22:33:35 -0700 Subject: [PATCH] backend: count iterative bytes for progress 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 --- backend.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend.c b/backend.c index c9875f48..89ac76b3 100644 --- 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) -- 2.25.1