[PATCH 3/4] imsm: FIX: Add spare disks information to array description

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

 



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@xxxxxxxxx>
---

 super-intel.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index fed831d..e06a6f4 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -4731,11 +4731,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;
@@ -4852,6 +4860,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;
 	}
 

--
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