]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Create: check for UnSet when looking at chunk
authorCzarnowska, Anna <anna.czarnowska@intel.com>
Wed, 30 Mar 2011 10:28:11 +0000 (11:28 +0100)
committerNeilBrown <neilb@suse.de>
Mon, 4 Apr 2011 23:27:40 +0000 (09:27 +1000)
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 <dan.j.williams@intel.com>
Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Create.c

index 9f344256f6e72050c25b585d0fa8fe7d91af2096..5709baf8556fe977feabb0e1bc050ce3278bf0cc 100644 (file)
--- 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);
                }