summaryrefslogtreecommitdiff
path: root/super1.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 /super1.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 'super1.c')
-rw-r--r--super1.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/super1.c b/super1.c
index 24c18c0e..a52df645 100644
--- a/super1.c
+++ b/super1.c
@@ -558,12 +558,13 @@ static void uuid_from_super1(struct supertype *st, int uuid[4])
cuuid[i] = super->set_uuid[i];
}
-static void getinfo_super1(struct supertype *st, struct mdinfo *info)
+static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map)
{
struct mdp_superblock_1 *sb = st->sb;
int working = 0;
unsigned int i;
- int role;
+ unsigned int role;
+ unsigned int map_disks = info->array.raid_disks;
info->array.major_version = 1;
info->array.minor_version = st->minor_version;
@@ -629,10 +630,16 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info)
} else
info->reshape_active = 0;
+ if (map)
+ for (i=0; i<map_disks; i++)
+ map[i] = 0;
for (i = 0; i < __le32_to_cpu(sb->max_dev); i++) {
role = __le16_to_cpu(sb->dev_roles[i]);
- if (/*role == 0xFFFF || */role < info->array.raid_disks)
+ if (/*role == 0xFFFF || */role < (unsigned) info->array.raid_disks) {
working++;
+ if (map && role < map_disks)
+ map[role] = 1;
+ }
}
info->array.working_disks = working;