From: Jens Axboe Date: Wed, 31 Aug 2011 19:14:12 +0000 (-0600) Subject: Add support for backwards holes X-Git-Tag: fio-1.58~14 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=a66da7a2354aac16757c75a824ad7cbba678535c;p=fio.git Add support for backwards holes If you did: bs=4k rw=read:-8k you would essentially rewind by 8k after reading 4k, causing the read to be sequentially backwards. Signed-off-by: Jens Axboe --- diff --git a/fio.h b/fio.h index 0c86f288..8401eda7 100644 --- a/fio.h +++ b/fio.h @@ -254,7 +254,7 @@ struct thread_options { unsigned int rw_seq; unsigned int kb_base; unsigned int ddir_seq_nr; - unsigned long ddir_seq_add; + long ddir_seq_add; unsigned int iodepth; unsigned int iodepth_low; unsigned int iodepth_batch; diff --git a/io_u.c b/io_u.c index 7709df5f..16c98b1f 100644 --- 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;