[PATCH 24/33] Monitor: Removed spare-group based spare sharing code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Czarnowska, Anna 
Sent: Monday, July 05, 2010 11:39 AM
To: Neil Brown
Cc: linux-raid@xxxxxxxxxxxxxxx; Czarnowska, Anna; Hawrylewicz Czarnowski, Przemyslaw; Labun, Marcin; Neubauer, Wojciech; Williams, Dan J; Ciechanowski, Ed; dledford@xxxxxxxxxx
Subject: [PATCH 24/33] Monitor: Removed spare-group based spare sharing code

Signed-off-by: Anna Czarnowska <anna.czarnowska@xxxxxxxxx>
---
 Monitor.c |   69 +-----------------------------------------------------------
 1 files changed, 2 insertions(+), 67 deletions(-)

diff --git a/Monitor.c b/Monitor.c
index 11f3758..932a2bc 100644
--- a/Monitor.c
+++ b/Monitor.c
@@ -43,7 +43,6 @@ struct state {
      int devnum; /* to sync with mdstat info */
      long utime;
      int err;
-     char *spare_group;
      int active, working, failed, spare, raid, total;
      int expected_spares;
      int devstate[MaxDisks];
@@ -191,10 +190,6 @@ int Monitor(mddev_dev_t devlist,
                  st->min_size = 0;
                  memset(st->devid, 0, MaxDisks*sizeof(int));
                  memset(st->devstate, 0, MaxDisks*sizeof(int));
-                 if (mdlist->spare_group)
-                       st->spare_group = strdup(mdlist->spare_group);
-                 else
-                       st->spare_group = NULL;
                  statelist = st;
            }
      } else {
@@ -211,7 +206,6 @@ int Monitor(mddev_dev_t devlist,
                  st->devnum = INT_MAX;
                  st->percent = -2;
                  st->expected_spares = -1;
-                 st->spare_group = NULL;
                  st->metadata_version = NULL;
                  st->missing = NULL;
                  st->parent = NULL;
@@ -222,8 +216,6 @@ int Monitor(mddev_dev_t devlist,
                  memset(st->devstate, 0, MaxDisks*sizeof(int));
                  if (mdlist) {
                        st->expected_spares = mdlist->spare_disks;
-                       if (mdlist->spare_group)
-                             st->spare_group = strdup(mdlist->spare_group);
                  }
                  statelist = st;
            }
@@ -513,7 +505,6 @@ int Monitor(mddev_dev_t devlist,
                              st->err = 1;
                              st->devnum = mse->devnum;
                              st->percent = -2;
-                             st->spare_group = NULL;
                              st->metadata_version = NULL;
                              st->missing = NULL;
                              st->parent = NULL;
@@ -527,65 +518,9 @@ int Monitor(mddev_dev_t devlist,
                              new_found = 1;
                        }
            }
+
            spare_sharing(statelist, mailaddr, mailfrom, alert_cmd, dosyslog);
-           /* If an array has active < raid && spare == 0 && spare_group != NULL
-           * Look for another array with spare > 0 and active == raid and same spare_group
-           *  if found, choose a device and hotremove/hotadd
-           */
-           for (st = statelist; st; st=st->next)
-                 if (st->active < st->raid &&
-                     st->spare == 0 &&
-                     st->spare_group != NULL) {
-                       struct state *st2;
-                       for (st2=statelist ; st2 ; st2=st2->next)
-                             if (st2 != st &&
-                                 st2->spare > 0 &&
-                                 st2->active == st2->raid &&
-                                 st2->spare_group != NULL &&
-                                 strcmp(st->spare_group, st2->spare_group) == 0) {
-                                   /* try to remove and add */
-                                   int fd1 = open(st->devname, O_RDONLY);
-                                   int fd2 = open(st2->devname, O_RDONLY);
-                                   int dev = -1;
-                                   int d;
-                                   if (fd1 < 0 || fd2 < 0) {
-                                         if (fd1>=0) close(fd1);
-                                         if (fd2>=0) close(fd2);
-                                         continue;
-                                   }
-                                   for (d=st2->raid; d < MaxDisks; d++) {
-                                         if (st2->devid[d] > 0 &&
-                                             st2->devstate[d] == 0) {
-                                               dev = st2->devid[d];
-                                               break;
-                                         }
-                                   }
-                                   if (dev > 0) {
-                                         struct mddev_dev_s devlist;
-                                         char devname[20];
-                                         devlist.next = NULL;
-                                         devlist.used = 0;
-                                         devlist.re_add = 0;
-                                         devlist.writemostly = 0;
-                                         devlist.devname = devname;
-                                         sprintf(devname, "%d:%d", major(dev), minor(dev));
-
-                                         devlist.disposition = 'r';
-                                         if (Manage_subdevs(st2->devname, fd2, &devlist, -1) == 0) {
-                                               devlist.disposition = 'a';
-                                               if (Manage_subdevs(st->devname, fd1, &devlist, -1) == 0) {
-                                                     alert("MoveSpare", st->devname, st2->devname, mailaddr, mailfrom, alert_cmd, dosyslog);
-                                                     close(fd1);
-                                                     close(fd2);
-                                                     break;
-                                               }
-                                               else Manage_subdevs(st2->devname, fd2, &devlist, -1);
-                                         }
-                                   }
-                                   close(fd1);
-                                   close(fd2);
-                             }
-                 }
+
            if (!new_found) {
                  if (oneshot)
                        break;
-- 
1.6.4.2


--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux