diff --git a/io_u.c b/io_u.c index 8546899c03e7..cbe14b3f5bda 100644 --- a/io_u.c +++ b/io_u.c @@ -283,8 +283,15 @@ static int get_next_seq_offset(struct thread_data *td, struct fio_file *f, f->last_pos = f->real_file_size; pos = f->last_pos - f->file_offset; - if (pos) + if (pos) { pos += td->o.ddir_seq_add; + /* + * If we reach beyond the end of the file with + * holed IO, wrap around to the beginning again. + */ + if (pos >= f->real_file_size) + pos = f->file_offset; + } *offset = pos; return 0;