]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Monitor: Check destination array domain early.
authorMarcin Labun <marcin.labun@intel.com>
Thu, 16 Dec 2010 14:16:12 +0000 (15:16 +0100)
committerNeilBrown <neilb@suse.de>
Mon, 20 Dec 2010 22:07:08 +0000 (09:07 +1100)
Destination arrays that do not have any domains are excluded
from spare sharing. We can check it early, without searching
for donor arrays.

Signed-off-by: Marcin Labun <marcin.labun@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Monitor.c

index ce160f3e3fb448839463297a450ce2d65f282ef7..e79f658b6d0795c21c0cc058db5e02e1b49068c1 100644 (file)
--- a/Monitor.c
+++ b/Monitor.c
@@ -767,8 +767,7 @@ static int move_spare(struct state *from, struct state *to,
        return 0;
 }
 
        return 0;
 }
 
-static int check_donor(struct state *from, struct state *to,
-                      struct domainlist *domlist)
+static int check_donor(struct state *from, struct state *to)
 {
        struct state *sub;
 
 {
        struct state *sub;
 
@@ -790,8 +789,6 @@ static int check_donor(struct state *from, struct state *to,
                        return 0;
        if (from->spare <= 0)
                return 0;
                        return 0;
        if (from->spare <= 0)
                return 0;
-       if (domlist == NULL)
-               return 0;
        return 1;
 }
 
        return 1;
 }
 
@@ -923,10 +920,15 @@ static void try_spare_migration(struct state *statelist, struct alert_info *info
                                                           to->metadata->ss->name);
                        if (to->spare_group)
                                domain_add(&domlist, to->spare_group);
                                                           to->metadata->ss->name);
                        if (to->spare_group)
                                domain_add(&domlist, to->spare_group);
-
+                       /*
+                        * No spare migration if the destination
+                        * has no domain. Skip this array.
+                        */
+                       if (!domlist)
+                               continue;
                        for (from=statelist ; from ; from=from->next) {
                                dev_t devid;
                        for (from=statelist ; from ; from=from->next) {
                                dev_t devid;
-                               if (!check_donor(from, to, domlist))
+                               if (!check_donor(from, to))
                                        continue;
                                if (from->metadata->ss->external)
                                        devid = container_choose_spare(
                                        continue;
                                if (from->metadata->ss->external)
                                        devid = container_choose_spare(