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 5e4209d3533252a965b7be6016d33300e3106db7..81ee724b7357a36651d4d6001bcf31c23b3853e9 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) {
         */
        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);
        }
 
                loop_cache_invalidate(td, f);
        }