Add support for backwards holes
[fio.git] / io_u.c
diff --git a/io_u.c b/io_u.c
index 7709df5fe55bf7fb6237d6b93476b2f09a2d3d3d..16c98b1f454869c43e4862b91c57b1278898de28 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -249,8 +249,12 @@ static int get_next_seq_block(struct thread_data *td, struct fio_file *f,
        assert(ddir_rw(ddir));
 
        if (f->last_pos < f->real_file_size) {
-               unsigned long long pos = f->last_pos - f->file_offset;
+               unsigned long long pos;
 
+               if (f->last_pos == f->file_offset && td->o.ddir_seq_add < 0)
+                       f->last_pos = f->real_file_size;
+
+               pos = f->last_pos - f->file_offset;
                if (pos)
                        pos += td->o.ddir_seq_add;