io_u: only rewind file position if it's non-zero
[fio.git] / io_u.c
diff --git a/io_u.c b/io_u.c
index a37b723e7f03124c48508b26cc64bd8786d37a6c..01b36938d1b5b8730c5e427fc278131c2a860487 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -430,7 +430,11 @@ static int get_next_seq_offset(struct thread_data *td, struct fio_file *f,
        if (f->last_pos[ddir] < f->real_file_size) {
                uint64_t pos;
 
-               if (f->last_pos[ddir] == f->file_offset && o->ddir_seq_add < 0) {
+               /*
+                * Only rewind if we already hit the end
+                */
+               if (f->last_pos[ddir] == f->file_offset &&
+                   f->file_offset && o->ddir_seq_add < 0) {
                        if (f->real_file_size > f->io_size)
                                f->last_pos[ddir] = f->io_size;
                        else