From 43063a1c8288d987eb9c14e2736b3b857836def6 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 27 Mar 2007 20:21:24 +0200 Subject: [PATCH] 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 --- io_u.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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) -- 2.25.1