From c7c280ed2e4f836bd8e9e125d55d097539b70e21 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 2 Nov 2006 20:10:33 +0100 Subject: [PATCH] [PATCH] Fix random_map If alignment was unlucky, we would underestimate the num_maps entry by 1. Signed-off-by: Jens Axboe --- init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.c b/init.c index b004d890..3532c49d 100644 --- a/init.c +++ b/init.c @@ -695,7 +695,7 @@ int init_random_state(struct thread_data *td) if (!td->norandommap) { for_each_file(td, f, i) { blocks = (f->file_size + td->min_bs - 1) / td->min_bs; - num_maps = blocks / BLOCKS_PER_MAP; + num_maps = (blocks + BLOCKS_PER_MAP-1)/ BLOCKS_PER_MAP; f->file_map = malloc(num_maps * sizeof(long)); f->num_maps = num_maps; memset(f->file_map, 0, num_maps * sizeof(long)); -- 2.25.1