]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Manage: remove call to validate_geometry.
authorNeilBrown <neilb@suse.de>
Tue, 30 Jul 2013 03:45:22 +0000 (13:45 +1000)
committerNeilBrown <neilb@suse.de>
Tue, 30 Jul 2013 03:45:22 +0000 (13:45 +1000)
This call to validate_geometry is really rather gratuitous.
It is purely about the fact that super0 cannot use more than 4TB.
So just make it an explicit test - less confusing that way.

With this, validate_geometry is only called from Create, which
makes it easier to reason about.

Also validate_geometry is now never passed NULL for the 'chunk'
parameter, so we can remove those annoying tests for NULL.

Signed-off-by: NeilBrown <neilb@suse.de>
Manage.c
super-ddf.c
super-intel.c
super0.c
super1.c

index 8d1bbd9779810bcd86daa91d255e48a354c8fcdd..0b0b78571330a4484aef3c8300f8693d1e695dbc 100644 (file)
--- a/Manage.c
+++ b/Manage.c
@@ -718,10 +718,8 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
                        return -1;
        }
 
-       if (tst->ss->validate_geometry(
-                   tst, array->level, array->layout,
-                   array->raid_disks, NULL,
-                   ldsize >> 9, INVALID_SECTORS, NULL, NULL, 0) == 0) {
+       if (tst->ss == &super0 && ldsize > 4ULL*1024*1024*2) {
+               /* More than 4TB is wasted on v0.90 */
                if (!force) {
                        pr_err("%s is larger than %s can "
                               "effectively use.\n"
index 47074feb529cbec5ef8a7ea522db680e2f93e3c9..683f9697a53b2cf5d8e1802256bdc12d3748dad3 100644 (file)
@@ -3185,14 +3185,14 @@ static int validate_geometry_ddf(struct supertype *st,
         * If given BVDs, we make an SVD, changing all the GUIDs in the process.
         */
 
-       if (chunk && *chunk == UnSet)
+       if (*chunk == UnSet)
                *chunk = DEFAULT_CHUNK;
 
        if (level == -1000000) level = LEVEL_CONTAINER;
        if (level == LEVEL_CONTAINER) {
                /* Must be a fresh device to add to a container */
                return validate_geometry_ddf_container(st, level, layout,
-                                                      raiddisks, chunk?*chunk:0,
+                                                      raiddisks, *chunk,
                                                       size, data_offset, dev,
                                                       freesize,
                                                       verbose);
@@ -3220,7 +3220,7 @@ static int validate_geometry_ddf(struct supertype *st,
                         * chosen so that add_to_super/getinfo_super
                         * can return them.
                         */
-                       return reserve_space(st, raiddisks, size, chunk?*chunk:0, freesize);
+                       return reserve_space(st, raiddisks, size, *chunk, freesize);
                }
                return 1;
        }
index baea13cc3a8170158039f3701ea770eb30a5bb00..4df33f4222319789293169aa7bbada5adf899492 100644 (file)
@@ -5854,10 +5854,10 @@ validate_geometry_imsm_orom(struct intel_super *super, int level, int layout,
                return 0;
        }
 
-       if (chunk && (*chunk == 0 || *chunk == UnSet))
+       if (*chunk == 0 || *chunk == UnSet)
                *chunk = imsm_default_chunk(super->orom);
 
-       if (super->orom && chunk && !imsm_orom_has_chunk(super->orom, *chunk)) {
+       if (super->orom && !imsm_orom_has_chunk(super->orom, *chunk)) {
                pr_vrb(": platform does not support a chunk size of: "
                       "%d\n", *chunk);
                return 0;
@@ -5874,7 +5874,7 @@ validate_geometry_imsm_orom(struct intel_super *super, int level, int layout,
                return 0;
        }
 
-       if (super->orom && (super->orom->attr & IMSM_OROM_ATTR_2TB) == 0 && chunk &&
+       if (super->orom && (super->orom->attr & IMSM_OROM_ATTR_2TB) == 0 &&
                        (calc_array_size(level, raiddisks, layout, *chunk, size) >> 32) > 0) {
                pr_vrb(": platform does not support a volume size over 2TB\n");
                return 0;
@@ -6188,7 +6188,7 @@ static int validate_geometry_imsm(struct supertype *st, int level, int layout,
                /* Must be a fresh device to add to a container */
                return validate_geometry_imsm_container(st, level, layout,
                                                        raiddisks,
-                                                       chunk?*chunk:0,
+                                                       *chunk,
                                                        size, data_offset,
                                                        dev, freesize,
                                                        verbose);
@@ -6224,7 +6224,7 @@ static int validate_geometry_imsm(struct supertype *st, int level, int layout,
                        }
                        if (freesize)
                                return reserve_space(st, raiddisks, size,
-                                                    chunk?*chunk:0, freesize);
+                                                    *chunk, freesize);
                }
                return 1;
        }
index 85acf368d0a1ba9b33d3b71f052f1df625fdc7be..3218377f74f4d72e12b4a6f4559d8041264ff0c6 100644 (file)
--- a/super0.c
+++ b/super0.c
@@ -1274,7 +1274,7 @@ static int validate_geometry0(struct supertype *st, int level,
                               "%d terabytes per device\n", tbmax);
                return 0;
        }
-       if (chunk && *chunk == UnSet)
+       if (*chunk == UnSet)
                *chunk = DEFAULT_CHUNK;
 
        if (!subdev)
index eb420580ef0caf3a1b1f1f8afea7390e00621197..f840459733a9dcea2b90fe83a7ba68bf96410498 100644 (file)
--- a/super1.c
+++ b/super1.c
@@ -2302,7 +2302,7 @@ static int validate_geometry1(struct supertype *st, int level,
                        pr_err("1.x metadata does not support containers\n");
                return 0;
        }
-       if (chunk && *chunk == UnSet)
+       if (*chunk == UnSet)
                *chunk = DEFAULT_CHUNK;
 
        if (!subdev)