Commit f381e71b authored by Jonathan Brassow's avatar Jonathan Brassow Committed by NeilBrown

DM RAID: Break-up untidy function

DM RAID:  Break-up untidy function

Clean-up excessive indentation by moving some code in raid_resume()
into its own function.
Signed-off-by: default avatarJonathan Brassow <jbrassow@redhat.com>
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent 9092c02d
......@@ -1572,32 +1572,21 @@ static void raid_postsuspend(struct dm_target *ti)
mddev_suspend(&rs->md);
}
static void raid_resume(struct dm_target *ti)
static void attempt_restore_of_faulty_devices(struct raid_set *rs)
{
int i;
uint64_t failed_devices, cleared_failed_devices = 0;
unsigned long flags;
struct dm_raid_superblock *sb;
struct raid_set *rs = ti->private;
struct md_rdev *r;
set_bit(MD_CHANGE_DEVS, &rs->md.flags);
if (!rs->bitmap_loaded) {
bitmap_load(&rs->md);
rs->bitmap_loaded = 1;
} else {
/*
* A secondary resume while the device is active.
* Take this opportunity to check whether any failed
* devices are reachable again.
*/
for (i = 0; i < rs->md.raid_disks; i++) {
r = &rs->dev[i].rdev;
if (test_bit(Faulty, &r->flags) && r->sb_page &&
sync_page_io(r, 0, r->sb_size,
r->sb_page, READ, 1)) {
DMINFO("Faulty device #%d has readable super"
"block. Attempting to revive it.", i);
sync_page_io(r, 0, r->sb_size, r->sb_page, READ, 1)) {
DMINFO("Faulty %s device #%d has readable super block."
" Attempting to revive it.",
rs->raid_type->name, i);
r->raid_disk = i;
r->saved_raid_disk = i;
flags = r->flags;
......@@ -1622,6 +1611,23 @@ static void raid_resume(struct dm_target *ti)
sb->failed_devices = cpu_to_le64(failed_devices);
}
}
}
static void raid_resume(struct dm_target *ti)
{
struct raid_set *rs = ti->private;
set_bit(MD_CHANGE_DEVS, &rs->md.flags);
if (!rs->bitmap_loaded) {
bitmap_load(&rs->md);
rs->bitmap_loaded = 1;
} else {
/*
* A secondary resume while the device is active.
* Take this opportunity to check whether any failed
* devices are reachable again.
*/
attempt_restore_of_faulty_devices(rs);
}
clear_bit(MD_RECOVERY_FROZEN, &rs->md.recovery);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment