X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=io_u.c;h=4750ac600a4272142bc85ccf9333382fcb1a4d28;hb=ccf8f1273301ccb286636ff169a7d47e09f47a90;hp=8acc0c3941783aa0ffb858d255c9b15d2d8cba8f;hpb=6a5e688425bb394946ef27134aa0f3de928c6a1f;p=fio.git diff --git a/io_u.c b/io_u.c index 8acc0c39..4750ac60 100644 --- a/io_u.c +++ b/io_u.c @@ -55,7 +55,7 @@ static void mark_random_map(struct thread_data *td, struct io_u *io_u) * If we have a mixed random workload, we may * encounter blocks we already did IO to. */ - if (!td->o.ddir_nr && !random_map_free(td, f, block)) + if (!td->o.ddir_nr == 1 && !random_map_free(td, f, block)) break; idx = RAND_MAP_IDX(td, f, block); @@ -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;