From db975ab5c3d68daef5e739c9263bb6c4e5b178b8 Mon Sep 17 00:00:00 2001 From: "Czarnowska, Anna" Date: Wed, 30 Mar 2011 11:28:11 +0100 Subject: [PATCH] Create: check for UnSet when looking at chunk A default chunk size of 0 gets modified to UnSet, so any location that checks for !chunk really needs to check for !(chunk || chunk == UnSet). Signed-off-by: Dan Williams Signed-off-by: Anna Czarnowska Signed-off-by: NeilBrown --- Create.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Create.c b/Create.c index 9f344256..5709baf8 100644 --- a/Create.c +++ b/Create.c @@ -266,7 +266,7 @@ int Create(struct supertype *st, char *mddev, &chunk, size*2, NULL, &newsize, verbose>=0)) return 1; - if (chunk) { + if (chunk && chunk != UnSet) { newsize &= ~(unsigned long long)(chunk*2 - 1); size &= ~(unsigned long long)(chunk - 1); } @@ -353,7 +353,7 @@ int Create(struct supertype *st, char *mddev, } freesize /= 2; /* convert to K */ - if (chunk) { + if (chunk && chunk != UnSet) { /* round to chunk size */ freesize = freesize & ~(chunk-1); } -- 2.39.2