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>
This commit is contained in:
NeilBrown 2014-04-09 16:56:45 +10:00
parent 217dead48f
commit d2ec75fb3e
1 changed files with 20 additions and 0 deletions

View File

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