summaryrefslogtreecommitdiff
path: root/super-ddf.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2014-05-06 11:42:12 +1000
committerNeilBrown <neilb@suse.de>2014-05-21 11:54:48 +1000
commit708997ffb7f0007ca9d42fc68289b34c2edbe8e2 (patch)
tree5c96c9f511d90132e31edc10888b46d45bb46824 /super-ddf.c
parent4fe903aa8b65f9a66d00a54d114c9a10ccdf21b0 (diff)
DDF: allow for unused slots when creating map list for getinfo_super_ddf.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'super-ddf.c')
-rw-r--r--super-ddf.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/super-ddf.c b/super-ddf.c
index 5a07c46e..475eadc4 100644
--- a/super-ddf.c
+++ b/super-ddf.c
@@ -2042,10 +2042,14 @@ static void getinfo_super_ddf(struct supertype *st, struct mdinfo *info, char *m
uuid_from_super_ddf(st, info->uuid);
if (map) {
- int i;
- for (i = 0 ; i < map_disks; i++) {
- if (i < info->array.raid_disks &&
- !(be16_to_cpu(ddf->phys->entries[i].state)
+ int i, e = 0;
+ int max = be16_to_cpu(ddf->phys->max_pdes);
+ for (i = e = 0 ; i < map_disks ; i++, e++) {
+ while (e < max &&
+ be32_to_cpu(ddf->phys->entries[e].refnum) == 0xffffffff)
+ e++;
+ if (i < info->array.raid_disks && e < max &&
+ !(be16_to_cpu(ddf->phys->entries[e].state)
& DDF_Failed))
map[i] = 1;
else