From: Jens Axboe Date: Tue, 27 Mar 2007 18:21:24 +0000 (+0200) Subject: Fix bug with not noticing end of file X-Git-Tag: fio-1.15~9 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=43063a1c8288d987eb9c14e2736b3b857836def6;p=fio.git Fix bug with not noticing end of file We repeatedly re-read the last end of a file, instead of skipping to a new one. The problem was that the offset got turned into a block number for comparison, so we would screw up if size % bs. Signed-off-by: Jens Axboe --- diff --git a/io_u.c b/io_u.c index 31d3b14b..f71856fc 100644 --- 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)