From 94827db3b336c59c23bb1c29692d5045af7f4bec Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Thu, 16 Dec 2010 11:33:23 +1100 Subject: [PATCH] imsm: add spares to --examine output. When we examine a container, list the spare devices as well as the active devices. Signed-off-by: NeilBrown --- super-intel.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/super-intel.c b/super-intel.c index 2be24a9e..74cfa6cf 100644 --- a/super-intel.c +++ b/super-intel.c @@ -804,7 +804,7 @@ static void examine_super_imsm(struct supertype *st, char *homehost) char nbuf[64]; __u32 sum; __u32 reserved = imsm_reserved_sectors(super, super->disks); - + struct dl *dl; snprintf(str, MPB_SIG_LEN, "%s", mpb->sig); printf(" Magic : %s\n", str); @@ -849,6 +849,26 @@ static void examine_super_imsm(struct supertype *st, char *homehost) continue; print_imsm_disk(mpb, i, reserved); } + for (dl = super->disks ; dl; dl = dl->next) { + struct imsm_disk *disk; + char str[MAX_RAID_SERIAL_LEN + 1]; + __u64 sz; + + if (dl->index >= 0) + continue; + + disk = &dl->disk; + printf("\n"); + snprintf(str, MAX_RAID_SERIAL_LEN + 1, "%s", disk->serial); + printf(" Disk Serial : %s\n", str); + printf(" State :%s%s%s\n", is_spare(disk) ? " spare" : "", + is_configured(disk) ? " active" : "", + is_failed(disk) ? " failed" : ""); + printf(" Id : %08x\n", __le32_to_cpu(disk->scsi_id)); + sz = __le32_to_cpu(disk->total_blocks) - reserved; + printf(" Usable Size : %llu%s\n", (unsigned long long)sz, + human_size(sz * 512)); + } } static void brief_examine_super_imsm(struct supertype *st, int verbose) -- 2.39.5