From: Czarnowska, Anna Date: Sun, 13 Feb 2011 22:27:09 +0000 (+1100) Subject: fix: imsm: size must be in K for rounding to chunk X-Git-Tag: mdadm-3.2.1~118 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=612e59d838b5480c2780a59f021eea2b32f3eb19;p=thirdparty%2Fmdadm.git fix: imsm: size must be in K for rounding to chunk chunk is in K so size must be converted to K before it is rounded. Otherwise we may get wrong freesize returned resulting in creation failure. Signed-off-by: Anna Czarnowska Signed-off-by: NeilBrown --- diff --git a/super-intel.c b/super-intel.c index 456eacc6..295aa1d0 100644 --- a/super-intel.c +++ b/super-intel.c @@ -4384,7 +4384,8 @@ static int reserve_space(struct supertype *st, int raiddisks, maxsize = merge_extents(super, extent_cnt); minsize = size; if (size == 0) - minsize = chunk; + /* chunk is in K */ + minsize = chunk * 2; if (cnt < raiddisks || (super->orom && used && used != raiddisks) || @@ -4397,8 +4398,8 @@ static int reserve_space(struct supertype *st, int raiddisks, if (size == 0) { size = maxsize; if (chunk) { - size /= chunk; - size *= chunk; + size /= 2 * chunk; + size *= 2 * chunk; } }