From ceadd59ef93421001530aa765d928e9e8c26b32e Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 2 Feb 2012 08:41:28 +0100 Subject: [PATCH] Make random map allocation more resilient Signed-off-by: Jens Axboe --- filesetup.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/filesetup.c b/filesetup.c index 8f515923..d55af454 100644 --- a/filesetup.c +++ b/filesetup.c @@ -849,11 +849,15 @@ int init_random_map(struct thread_data *td) (unsigned long long) td->o.rw_min_bs; num_maps = (blocks + BLOCKS_PER_MAP - 1) / (unsigned long long) BLOCKS_PER_MAP; - f->file_map = smalloc(num_maps * sizeof(unsigned long)); - if (f->file_map) { - f->num_maps = num_maps; - continue; - } + if (num_maps == (unsigned long) num_maps) { + f->file_map = smalloc(num_maps * sizeof(unsigned long)); + if (f->file_map) { + f->num_maps = num_maps; + continue; + } + } else + f->file_map = NULL; + if (!td->o.softrandommap) { log_err("fio: failed allocating random map. If running" " a large number of jobs, try the 'norandommap'" -- 2.25.1