]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Enhance raid4 support: --assemble and --monitor wasn't quite happy with it.
authorDoug Ledford <dledford@redhat.com>
Mon, 9 Jul 2007 00:00:02 +0000 (10:00 +1000)
committerNeil Brown <neilb@suse.de>
Mon, 9 Jul 2007 00:00:02 +0000 (10:00 +1000)
From: Doug Ledford <dledford@redhat.com>

This one actually does a couple things.  Mainly related to raid4, but
kinda touches other raid levels some.

When creating a raid4 array, treat it like a raid5 array in that we
create it in degraded mode by default and add the last disk as a spare.
Besides speeding things up, this has a second effect that it makes mdadm
more consistent.  In order to create a degraded raid5 array, you need
only passing missing as one of the devices.  For a degraded raid4 array,
prior to this patch, you must pass assume-clean or else it refuses to
create the array.  Even force won't make it work without assume-clean.
With the patch, raid4 behaves identical to raid5.

Separate from that, the monitor functionality completely ignores raid4
arrays.  That seems to stem from the code that checks to see if the
array is part of a long list of types.  It seems easier to check which
array types *aren't* redundant instead of listing the ones that are
redundant and missing some of them.  This makes the monitor service
actually watch raid4 arrays.

Create.c
Monitor.c
tests/00raid4

index 08972ae1b7703b3e2069e8584324b6ad025c123d..3e6f1af8799da56d287d6f6ee3525074e79aed61 100644 (file)
--- a/Create.c
+++ b/Create.c
@@ -315,12 +315,13 @@ int Create(struct supertype *st, char *mddev, int mdfd,
                }
        }
 
-       /* If this is  raid5, we want to configure the last active slot
+       /* If this is raid4/5, we want to configure the last active slot
         * as missing, so that a reconstruct happens (faster than re-parity)
         * FIX: Can we do this for raid6 as well?
         */
        if (assume_clean==0 && force == 0 && first_missing >= raiddisks) {
                switch ( level ) {
+               case 4:
                case 5:
                        insert_point = raiddisks-1;
                        sparedisks++;
@@ -345,7 +346,7 @@ int Create(struct supertype *st, char *mddev, int mdfd,
                array.md_minor = minor(stb.st_rdev);
        array.not_persistent = 0;
        /*** FIX: Need to do something about RAID-6 here ***/
-       if ( ( (level == 5) &&
+       if ( ( (level == 4 || level == 5) &&
               (insert_point < raiddisks || first_missing < raiddisks) )
             ||
             ( level == 6 && missing_disks == 2)
index 79a88a7d8feabbad8c64e43ad076cddff63ea552..91f02a4443ee861ad8cc8a6d156b6f9edb019366 100644 (file)
--- a/Monitor.c
+++ b/Monitor.c
@@ -245,8 +245,10 @@ int Monitor(mddev_dev_t devlist,
                                close(fd);
                                continue;
                        }
-                       if (array.level != 1 && array.level != 5 && array.level != -4 &&
-                               array.level != 6 && array.level != 10) {
+                       /* It's much easier to list what array levels can't
+                        * have a device disappear than all of them that can
+                        */
+                       if (array.level == 0 || array.level == -1) {
                                if (!st->err)
                                        alert("DeviceDisappeared", dev, "Wrong-Level",
                                              mailaddr, mailfrom, alert_cmd, dosyslog);
@@ -401,9 +403,8 @@ int Monitor(mddev_dev_t devlist,
                        struct mdstat_ent *mse;
                        for (mse=mdstat; mse; mse=mse->next) 
                                if (mse->devnum != MAXINT &&
-                                   (strcmp(mse->level, "raid1")==0 ||
-                                    strcmp(mse->level, "raid5")==0 ||
-                                    strcmp(mse->level, "multipath")==0)
+                                   (strcmp(mse->level, "raid0")!=0 &&
+                                    strcmp(mse->level, "linear")!=0)
                                        ) {
                                        struct state *st = malloc(sizeof *st);
                                        mdu_array_info_t array;
index 3618aa9cee550c95e48c60c96fd949bdc60757b3..ddb16b185bde2a242c8e6ce4551a3d8f6f152de6 100644 (file)
@@ -8,7 +8,7 @@ mdadm -S $md0
 
 # now with version-1 superblock
 mdadm -CR $md0 -e1 --level=raid4 -n4 $dev0 $dev1 $dev2 $dev3 
-check resync; check raid[45]
+check recovery; check raid[45]
 testdev $md0 3 $mdsize1 64
 mdadm -S $md0