From: NeilBrown Date: Wed, 9 Apr 2014 06:56:45 +0000 (+1000) Subject: DDF: examine_pds to also list devices that aren't in the metadata. X-Git-Tag: mdadm-3.3.1~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2ec75fb3ef359ccd6eb35dd9e9ce60430b8ebe9;p=thirdparty%2Fmdadm.git DDF: examine_pds to also list devices that aren't in the metadata. The phys disks table should list all disks, but if the metadata is corrupt, it might not even list the disk it was read from. So check for and report any known disks that aren't listed. Signed-off-by: NeilBrown --- diff --git a/super-ddf.c b/super-ddf.c index f8ff00c2..f982460b 100644 --- a/super-ddf.c +++ b/super-ddf.c @@ -488,6 +488,7 @@ struct ddf_super { /* These fields used by auto-layout */ int raiddisk; /* slot to fill in autolayout */ __u64 esize; + int displayed; }; }; struct disk_data disk; @@ -1488,9 +1489,13 @@ static void examine_pds(struct ddf_super *sb) int cnt = be16_to_cpu(sb->phys->max_pdes); int i; struct dl *dl; + int unlisted = 0; printf(" Physical Disks : %d\n", cnt); printf(" Number RefNo Size Device Type/State\n"); + for (dl = sb->dlist; dl; dl = dl->next) + dl->displayed = 0; + for (i=0 ; iphys->entries[i]; int type = be16_to_cpu(pd->type); @@ -1516,6 +1521,8 @@ static void examine_pds(struct ddf_super *sb) } if (!dl) printf("%15s",""); + else + dl->displayed = 1; printf(" %s%s%s%s%s", (type&2) ? "active":"", (type&4) ? "Global-Spare":"", @@ -1535,6 +1542,19 @@ static void examine_pds(struct ddf_super *sb) (state&64)? ", Missing" : ""); printf("\n"); } + for (dl = sb->dlist; dl; dl = dl->next) { + char *dv; + if (dl->displayed) + continue; + if (!unlisted) + printf(" Physical disks not in metadata!:\n"); + unlisted = 1; + dv = map_dev(dl->major, dl->minor, 0); + printf(" %08x %s\n", be32_to_cpu(dl->disk.refnum), + dv ? dv : "-unknown-"); + } + if (unlisted) + printf("\n"); } static void examine_super_ddf(struct supertype *st, char *homehost)