From 708997ffb7f0007ca9d42fc68289b34c2edbe8e2 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 6 May 2014 11:42:12 +1000 Subject: [PATCH] DDF: allow for unused slots when creating map list for getinfo_super_ddf. Signed-off-by: NeilBrown --- super-ddf.c | 12 ++++++++---- 1 file 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 -- 2.47.2