From e03640bda562df11b60ceaaa40a56425f358090e Mon Sep 17 00:00:00 2001 From: "Czarnowska, Anna" Date: Mon, 2 Apr 2012 10:16:04 +1000 Subject: [PATCH] simplify calculating array_blocks no point calling info_to_blocks_per_member when it just returns size*2 for level==1 calc_array_size can be used for all levels Signed-off-by: Anna Czarnowska Signed-off-by: NeilBrown --- super-intel.c | 5 +---- util.c | 2 ++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/super-intel.c b/super-intel.c index 480b3793..642ca268 100644 --- a/super-intel.c +++ b/super-intel.c @@ -4623,10 +4623,7 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info, } strncpy((char *) dev->volume, name, MAX_RAID_SERIAL_LEN); - if (info->level == 1) - array_blocks = info_to_blocks_per_member(info, size); - else - array_blocks = calc_array_size(info->level, info->raid_disks, + array_blocks = calc_array_size(info->level, info->raid_disks, info->layout, info->chunk_size, size * 2); /* round array size down to closest MB */ diff --git a/util.c b/util.c index 7abbff75..d32e6506 100644 --- a/util.c +++ b/util.c @@ -711,6 +711,8 @@ void print_r10_layout(int layout) unsigned long long calc_array_size(int level, int raid_disks, int layout, int chunksize, unsigned long long devsize) { + if (level == 1) + return devsize; devsize &= ~(unsigned long long)((chunksize>>9)-1); return get_data_disks(level, layout, raid_disks) * devsize; } -- 2.39.2