X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=io_u.c;h=4750ac600a4272142bc85ccf9333382fcb1a4d28;hp=18e3c3f1c5b9d08d40e4b3b40876b8a36e6a8e4d;hb=fdf287440fa8486f0e96c8597349d5d25e98fb6a;hpb=b6a4c7d152075209ba84ca05c32154427cbcd275 diff --git a/io_u.c b/io_u.c index 18e3c3f1..4750ac60 100644 --- a/io_u.c +++ b/io_u.c @@ -162,10 +162,11 @@ 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 { - if (f->last_pos >= f->real_file_size) - return 1; - - b = f->last_pos / td->o.min_bs[ddir]; + if (f->last_pos >= f->real_file_size) { + if (!td_random(td) || get_next_rand_offset(td, f, ddir, &b)) + return 1; + } else + b = (f->last_pos - f->file_offset) / td->o.min_bs[ddir]; } io_u->offset = (b * td->o.min_bs[ddir]) + f->file_offset;