io_u: reset file to initial offset
authorJens Axboe <axboe@kernel.dk>
Wed, 1 Nov 2017 20:51:03 +0000 (14:51 -0600)
committerJens Axboe <axboe@kernel.dk>
Wed, 1 Nov 2017 20:51:03 +0000 (14:51 -0600)
Don't assume that initial offset is 0, we should use the set
f->file_offset when resetting.

Fixes: 17373ce2f38a ("io_u: wrap to beginning when end-of-file is reached for time_based")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_u.c

diff --git a/io_u.c b/io_u.c
index 5e4209d..81ee724 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -367,7 +367,7 @@ static int get_next_seq_offset(struct thread_data *td, struct fio_file *f,
         */
        if (f->last_pos[ddir] >= f->io_size + get_start_offset(td, f) &&
            o->time_based) {
-               f->last_pos[ddir] = 0;
+               f->last_pos[ddir] = f->file_offset;
                loop_cache_invalidate(td, f);
        }