io_u: ensure to invalidate cache on time_based random reads
authorJens Axboe <axboe@kernel.dk>
Thu, 31 May 2018 15:05:59 +0000 (09:05 -0600)
committerJens Axboe <axboe@kernel.dk>
Thu, 31 May 2018 15:05:59 +0000 (09:05 -0600)
We need to do this with the file reset and retrieval of a
new offset, not of it fails.

Fixes: 0bcf41cdc22df ("io_u: re-invalidate cache when looping around without file open/close")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
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",