]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Change 'size' argument to validate_geometry to be sectors, not K
authorNeilBrown <neilb@suse.de>
Thu, 4 Dec 2008 04:47:57 +0000 (15:47 +1100)
committerNeilBrown <neilb@suse.de>
Thu, 4 Dec 2008 04:47:57 +0000 (15:47 +1100)
That way it is the same a *freesize, and generally less confusing.

Signed-off-by: NeilBrown <neilb@suse.de>
Create.c
mdadm.h
super-intel.c
super0.c

index f69cfd9a3e57bce429b041df4f8c0a6b752f3ef2..7ea39c4f6fd8e7a2181890ff924381537d3576da 100644 (file)
--- a/Create.c
+++ b/Create.c
@@ -240,7 +240,7 @@ int Create(struct supertype *st, char *mddev,
        }
 
        if (st && ! st->ss->validate_geometry(st, level, layout, raiddisks,
-                                             chunk, size, NULL, NULL, verbose>=0))
+                                             chunk, size*2, NULL, NULL, verbose>=0))
                return 1;
 
        /* now look at the subdevs */
@@ -276,7 +276,7 @@ int Create(struct supertype *st, char *mddev,
                                st = superlist[i]->match_metadata_desc(name);
                                if (st && !st->ss->validate_geometry
                                                (st, level, layout, raiddisks,
-                                                chunk, size, dname, &freesize,
+                                                chunk, size*2, dname, &freesize,
                                                 verbose > 0))
                                        st = NULL;
                        }
@@ -293,7 +293,7 @@ int Create(struct supertype *st, char *mddev,
                } else {
                        if (!st->ss->validate_geometry(st, level, layout,
                                                       raiddisks,
-                                                      chunk, size, dname,
+                                                      chunk, size*2, dname,
                                                       &freesize,
                                                       verbose > 0)) {
 
@@ -356,7 +356,7 @@ int Create(struct supertype *st, char *mddev,
                        /* size is meaningful */
                        if (!st->ss->validate_geometry(st, level, layout,
                                                       raiddisks,
-                                                      chunk, minsize,
+                                                      chunk, minsize*2,
                                                       NULL, NULL, 0)) {
                                fprintf(stderr, Name ": devices too large for RAID level %d\n", level);
                                return 1;
diff --git a/mdadm.h b/mdadm.h
index 05b79bafa9497843a59b308a3b227bd7a3f7ba1e..b0966e6f9f9fa9c2b310605d843160ac1ff0dbeb 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -532,6 +532,7 @@ extern struct superswitch {
         * added to validate changing size and new devices.  If there are
         * inter-device dependencies, it should record sufficient details
         * so these can be validated.
+        * Both 'size' and '*freesize' are in sectors.  chunk is bytes.
         */
        int (*validate_geometry)(struct supertype *st, int level, int layout,
                                 int raiddisks,
index 99419ffd5cc6cbc2acf0a16caa67df622963bd28..f78957f13549325932cb22d7c45c89a21b154a82 100644 (file)
@@ -2295,7 +2295,7 @@ static int validate_geometry_imsm_volume(struct supertype *st, int level,
                 * 'raiddisks' device extents of size 'size' at a given
                 * offset
                 */
-               unsigned long long minsize = size*2 /* convert to blocks */;
+               unsigned long long minsize = size;
                unsigned long long start_offset = ~0ULL;
                int dcnt = 0;
                if (minsize == 0)
index ab4232b0b5b34d10624e33060a28434e0f68db67..5d17073b07f789b0cfcd29b65af8da2a760574f8 100644 (file)
--- a/super0.c
+++ b/super0.c
@@ -1057,7 +1057,7 @@ static int validate_geometry0(struct supertype *st, int level,
                return 0;
        if (raiddisks > MD_SB_DISKS)
                return 0;
-       if (size > (0x7fffffffULL<<10))
+       if (size > (0x7fffffffULL<<9))
                return 0;
        if (!subdev)
                return 1;
@@ -1078,7 +1078,7 @@ static int validate_geometry0(struct supertype *st, int level,
 
        if (ldsize < MD_RESERVED_SECTORS * 512)
                return 0;
-       if (size > (0x7fffffffULL<<10))
+       if (size > (0x7fffffffULL<<9))
                return 0;
        *freesize = MD_NEW_SIZE_SECTORS(ldsize >> 9);
        return 1;