summaryrefslogtreecommitdiffstats
path: root/super-ddf.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2014-04-09 08:56:45 +0200
committerNeilBrown <neilb@suse.de>2014-05-21 03:54:47 +0200
commitd2ec75fb3ef359ccd6eb35dd9e9ce60430b8ebe9 (patch)
treec8e696c089a3d8d6c224446cc8d3f6a36e8e55ab /super-ddf.c
parentDDF: fix usage of ->used_pdes (diff)
downloadmdadm-d2ec75fb3ef359ccd6eb35dd9e9ce60430b8ebe9.tar.xz
mdadm-d2ec75fb3ef359ccd6eb35dd9e9ce60430b8ebe9.zip
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 <neilb@suse.de>
Diffstat (limited to 'super-ddf.c')
-rw-r--r--super-ddf.c20
1 files changed, 20 insertions, 0 deletions
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 ; i<cnt ; i++) {
struct phys_disk_entry *pd = &sb->phys->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)