imsm: FIX: Add spare disks information to array description

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>
This commit is contained in:
Adam Kwolek 2011-02-14 11:09:22 +11:00 committed by NeilBrown
parent 08f9e34bb5
commit abef11a38d
1 changed files with 9 additions and 0 deletions

View 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;
}