X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=io_u.c;h=55f3c78c72cbd773cf24a503e30814a9c788e1cf;hp=18e3c3f1c5b9d08d40e4b3b40876b8a36e6a8e4d;hb=0c3d768a44543dd6c23337eafc726e7f88dc3076;hpb=b6a4c7d152075209ba84ca05c32154427cbcd275 diff --git a/io_u.c b/io_u.c index 18e3c3f1..55f3c78c 100644 --- a/io_u.c +++ b/io_u.c @@ -162,10 +162,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 { - 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 / td->o.min_bs[ddir]; + } } io_u->offset = (b * td->o.min_bs[ddir]) + f->file_offset;