From b0a84f48509d76032455842f1482901e3ab12afd Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 9 May 2016 13:31:01 -0600 Subject: [PATCH] io_u: if we're doing backwards IO, wrap to end (not start) 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 --- io_u.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/io_u.c b/io_u.c index eb15dc28..f9870e70 100644 --- a/io_u.c +++ b/io_u.c @@ -371,10 +371,15 @@ static int get_next_seq_offset(struct thread_data *td, struct fio_file *f, /* * 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; -- 2.25.1