io_u: ensure to invalidate cache on time_based random reads
[fio.git] / io_u.c
diff --git a/io_u.c b/io_u.c
index 5b4c0df06ad5774aa6ffde99407465b5d8335e61..945aa19288bdc333c0d7a5e6087c54813ea420d3 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -325,9 +325,9 @@ static int get_next_rand_block(struct thread_data *td, struct fio_file *f,
        if (td->o.time_based ||
            (td->o.file_service_type & __FIO_FSERVICE_NONUNIFORM)) {
                fio_file_reset(td, f);
        if (td->o.time_based ||
            (td->o.file_service_type & __FIO_FSERVICE_NONUNIFORM)) {
                fio_file_reset(td, f);
+               loop_cache_invalidate(td, f);
                if (!get_next_rand_offset(td, f, ddir, b))
                        return 0;
                if (!get_next_rand_offset(td, f, ddir, b))
                        return 0;
-               loop_cache_invalidate(td, f);
        }
 
        dprint(FD_IO, "%s: rand offset failed, last=%llu, size=%llu\n",
        }
 
        dprint(FD_IO, "%s: rand offset failed, last=%llu, size=%llu\n",