If we have a job with a start file offset and we're doing holed
IO, we want to wrap to the start offset for forwards holes, but
to the end for backwards holes.
Signed-off-by: Jens Axboe <axboe@fb.com>
/*
* If we reach beyond the end of the file
* with holed IO, wrap around to the
- * beginning again.
+ * beginning again. If we're doing backwards IO,
+ * wrap to the end.
*/
- if (pos >= f->real_file_size)
- pos = f->file_offset;
+ if (pos >= f->real_file_size) {
+ if (o->ddir_seq_add > 0)
+ pos = f->file_offset;
+ else
+ pos = f->real_file_size + o->ddir_seq_add;
+ }
}
*offset = pos;