]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
imsm: use disk_ord_tbl to identify rebuilding disks
authorDan Williams <dan.j.williams@intel.com>
Fri, 15 Aug 2008 17:57:19 +0000 (10:57 -0700)
committerDan Williams <dan.j.williams@intel.com>
Fri, 15 Aug 2008 17:57:19 +0000 (10:57 -0700)
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
super-intel.c

index ccf42327a17c02a59db37bab9a1e0f555e24facc..677ab196778dc6125f7f14865856bdd8dc8988d5 100644 (file)
@@ -68,8 +68,10 @@ struct imsm_map {
        __u8  num_members;      /* number of member disks */
        __u8  reserved[3];
        __u32 filler[7];        /* expansion area */
+#define IMSM_ORD_REBUILD (1 << 24)
        __u32 disk_ord_tbl[1];  /* disk_ord_tbl[num_members],
-                                  top byte special */
+                                * top byte contains some flags
+                                */
 } __attribute__ ((packed));
 
 struct imsm_vol {
@@ -339,10 +341,24 @@ static __u32 get_imsm_disk_idx(struct imsm_map *map, int slot)
 {
        __u32 *ord_tbl = &map->disk_ord_tbl[slot];
 
-       /* top byte is 'special' */
+       /* top byte identifies disk under rebuild
+        * why not just use the USABLE bit... oh well.
+        */
        return __le32_to_cpu(*ord_tbl & ~(0xff << 24));
 }
 
+static __u32 get_imsm_ord_tbl_ent(struct imsm_dev *dev, int slot)
+{
+       struct imsm_map *map;
+
+       if (dev->vol.migr_state)
+               map = get_imsm_map(dev, 0);
+       else
+               map = get_imsm_map(dev, 1);
+
+       return map->disk_ord_tbl[slot];
+}
+
 static int get_imsm_raid_level(struct imsm_map *map)
 {
        if (map->raid_level == 1) {
@@ -2027,9 +2043,11 @@ static struct mdinfo *container_content_imsm(struct supertype *st)
                        int idx;
                        int skip;
                        __u32 s;
+                       __u32 ord;
 
                        skip = 0;
                        idx = get_imsm_disk_idx(map, slot);
+                       ord = get_imsm_ord_tbl_ent(dev, slot); 
                        for (d = super->disks; d ; d = d->next)
                                if (d->index == idx)
                                         break;
@@ -2042,6 +2060,8 @@ static struct mdinfo *container_content_imsm(struct supertype *st)
                                skip = 1;
                        if (!(s & USABLE_DISK))
                                skip = 1;
+                       if (ord & IMSM_ORD_REBUILD)
+                               skip = 1;
 
                        /* 
                         * if we skip some disks the array will be assmebled degraded;