[PATCH] Fix fileoffset option
[fio.git] / io_u.c
diff --git a/io_u.c b/io_u.c
index 55f3c78c72cbd773cf24a503e30814a9c788e1cf..4750ac600a4272142bc85ccf9333382fcb1a4d28 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -165,9 +165,8 @@ static int get_next_offset(struct thread_data *td, struct io_u *io_u)
                if (f->last_pos >= f->real_file_size) {
                        if (!td_random(td) || get_next_rand_offset(td, f, ddir, &b))
                                return 1;
-               } else {
-                       b = f->last_pos / td->o.min_bs[ddir];
-               }
+               } else
+                       b = (f->last_pos - f->file_offset) / td->o.min_bs[ddir];
        }
 
        io_u->offset = (b * td->o.min_bs[ddir]) + f->file_offset;