Loop Iteration Offset Bug
authorBrian Fulton <bfulton@google.com>
Fri, 24 Oct 2014 20:47:34 +0000 (14:47 -0600)
committerJens Axboe <axboe@fb.com>
Fri, 24 Oct 2014 20:47:34 +0000 (14:47 -0600)
Reset file descriptor offset value to the initial value when file is
closed and io state is cleared. This fixes the bug where previous offset
values persist between loop iterations.

Signed-off-by: Jens Axboe <axboe@fb.com>
libfio.c

index 9ed802a99228eab56f275933a42d08ee68d33cf6..b823bd4779bfed19b1ae0c544a52eb79f17ebcd6 100644 (file)
--- a/libfio.c
+++ b/libfio.c
@@ -108,8 +108,10 @@ void clear_io_state(struct thread_data *td)
        reset_io_counters(td);
 
        close_files(td);
-       for_each_file(td, f, i)
+       for_each_file(td, f, i) {
                fio_file_clear_done(f);
+               f->file_offset = get_start_offset(td, f);
+       }
 
        /*
         * Set the same seed to get repeatable runs