]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
imsm: FIX: Add spare disks information to array description
authorAdam Kwolek <adam.kwolek@intel.com>
Mon, 14 Feb 2011 00:09:22 +0000 (11:09 +1100)
committerNeilBrown <neilb@suse.de>
Mon, 14 Feb 2011 00:09:22 +0000 (11:09 +1100)
Spares that are specified on container can be used by any array in container.
this means that for every array in container they should be reported.
This let caller know how many spare devices (not used in any array)
are still available.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
super-intel.c

index c4204d028729f6460a041cc608b1ff089895d79a..f3e248e5341b1280210399988ce584915264eba1 100644 (file)
@@ -4732,11 +4732,19 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
        struct mdinfo *rest = NULL;
        unsigned int i;
        int bbm_errors = 0;
+       struct dl *d;
+       int spare_disks = 0;
 
        /* check for bad blocks */
        if (imsm_bbm_log_size(super->anchor))
                bbm_errors = 1;
 
+       /* count spare devices, not used in maps
+        */
+       for (d = super->disks; d; d = d->next)
+               if (d->index == -1)
+                       spare_disks++;
+
        for (i = 0; i < mpb->num_raid_devs; i++) {
                struct imsm_dev *dev;
                struct imsm_map *map;
@@ -4853,6 +4861,7 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
                }
                /* now that the disk list is up-to-date fixup recovery_start */
                update_recovery_start(dev, this);
+               this->array.spare_disks += spare_disks;
                rest = this;
        }