iolog: fix issue with replay rate
authorJens Axboe <axboe@kernel.dk>
Sat, 14 Apr 2018 21:22:10 +0000 (15:22 -0600)
committerJens Axboe <axboe@kernel.dk>
Sat, 14 Apr 2018 21:22:10 +0000 (15:22 -0600)
We attempt to keep the replay rate accurate, but we mistakenly use
the 'delay' value which we have decremented along the way. Store
the original and use that for the stall detection.

This fixes replays going quicker than they should.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
iolog.c

diff --git a/iolog.c b/iolog.c
index bfafc032f4bc63dc03964d4b050d2a0089723916..3f0fc22bc049121ab7488fd81665adbeafec264b 100644 (file)
--- a/iolog.c
+++ b/iolog.c
@@ -63,6 +63,7 @@ void log_file(struct thread_data *td, struct fio_file *f,
 static void iolog_delay(struct thread_data *td, unsigned long delay)
 {
        uint64_t usec = utime_since_now(&td->last_issue);
+       unsigned long orig_delay = delay;
        uint64_t this_delay;
        struct timespec ts;
 
@@ -88,8 +89,8 @@ static void iolog_delay(struct thread_data *td, unsigned long delay)
        }
 
        usec = utime_since_now(&ts);
-       if (usec > delay)
-               td->time_offset = usec - delay;
+       if (usec > orig_delay)
+               td->time_offset = usec - orig_delay;
        else
                td->time_offset = 0;
 }