summaryrefslogtreecommitdiff
path: root/super0.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2010-11-22 19:35:25 +1100
committerNeilBrown <neilb@suse.de>2010-11-22 19:35:25 +1100
commita5d85af748aafe3e3830b9d16faa5c92e783b171 (patch)
tree226da96fa25afdd3bc97ead7e91b5e59b10a8e8f /super0.c
parentf94c116f56cb821bfd619481d94fcd78ab8b53c0 (diff)
get_info_super: report which other devices are thought to be working/failed.
To accurately detect when an array has been split and is now being recombined, we need to track which other devices each thinks is working. We should never include a device in an array if it thinks that the primary device has failed. This patch just allows get_info_super to return a list of devices and whether they are thought to be working or not. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'super0.c')
-rw-r--r--super0.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/super0.c b/super0.c
index a650c3e6..b9d149eb 100644
--- a/super0.c
+++ b/super0.c
@@ -339,11 +339,12 @@ static void uuid_from_super0(struct supertype *st, int uuid[4])
}
}
-static void getinfo_super0(struct supertype *st, struct mdinfo *info)
+static void getinfo_super0(struct supertype *st, struct mdinfo *info, char *map)
{
mdp_super_t *sb = st->sb;
int working = 0;
int i;
+ int map_disks = info->array.raid_disks;
info->array.major_version = sb->major_version;
info->array.minor_version = sb->minor_version;
@@ -391,8 +392,12 @@ static void getinfo_super0(struct supertype *st, struct mdinfo *info)
if ((sb->disks[i].state & (1<<MD_DISK_SYNC)) &&
(sb->disks[i].raid_disk < (unsigned)info->array.raid_disks) &&
(sb->disks[i].state & (1<<MD_DISK_ACTIVE)) &&
- !(sb->disks[i].state & (1<<MD_DISK_FAULTY)))
+ !(sb->disks[i].state & (1<<MD_DISK_FAULTY))) {
working ++;
+ if (map && i < map_disks)
+ map[i] = 1;
+ } else if (map && i < map_disks)
+ map[i] = 0;
info->array.working_disks = working;
}