From 38f30c81d8d194da047950cbbda3896bd35cd98c Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 11 Jan 2013 14:03:05 +0100 Subject: [PATCH] filesetup: limit rand map to the actual IO size, if needed No need allocating a larger map than we need. Signed-off-by: Jens Axboe --- filesetup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/filesetup.c b/filesetup.c index ab5cc48d..478bda8c 100644 --- a/filesetup.c +++ b/filesetup.c @@ -956,7 +956,9 @@ int init_random_map(struct thread_data *td) return 0; for_each_file(td, f, i) { - blocks = (f->real_file_size + td->o.rw_min_bs - 1) / + uint64_t file_size = min(f->real_file_size, f->io_size); + + blocks = (file_size + td->o.rw_min_bs - 1) / (unsigned long long) td->o.rw_min_bs; if (td->o.random_generator == FIO_RAND_GEN_LFSR) { unsigned long seed; -- 2.25.1