Fix bug with not noticing end of file
[fio.git] / io_u.c
diff --git a/io_u.c b/io_u.c
index 31d3b14be50d0e124a8de277245cc043f4d1c624..f71856fc8b943b08fcc0835f3c91eeacd790b6bb 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -142,8 +142,12 @@ static int get_next_offset(struct thread_data *td, struct io_u *io_u)
 
                if (get_next_rand_offset(td, f, ddir, &b))
                        return 1;
-       } else
+       } else {
+               if (f->last_pos >= f->real_file_size)
+                       return 1;
+
                b = f->last_pos / td->o.min_bs[ddir];
+       }
 
        io_u->offset = (b * td->o.min_bs[ddir]) + f->file_offset;
        if (io_u->offset >= f->real_file_size)