summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2009-03-31 14:57:20 +1100
committerNeilBrown <neilb@suse.de>2009-03-31 14:57:20 +1100
commitfc9739c6d626ee79a148ec367d143b0601299a9d (patch)
tree492a3a29fe44fdd99d9177bef77b16a463a771f9 /drivers
parente9d4758f6e93488dc719a1445ce54659a570938f (diff)
downloadlinux-3.10-fc9739c6d626ee79a148ec367d143b0601299a9d.tar.gz
linux-3.10-fc9739c6d626ee79a148ec367d143b0601299a9d.tar.bz2
linux-3.10-fc9739c6d626ee79a148ec367d143b0601299a9d.zip
md: add takeover support for converting raid6 back into raid5
If a raid6 is still in the layout that comes from converting raid5 into a raid6. this will allow us to convert it back again. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/md/raid5.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 95953273c4d..70b50af2bcd 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -4912,6 +4912,39 @@ static void *raid5_takeover_raid1(mddev_t *mddev)
return setup_conf(mddev);
}
+static void *raid5_takeover_raid6(mddev_t *mddev)
+{
+ int new_layout;
+
+ switch (mddev->layout) {
+ case ALGORITHM_LEFT_ASYMMETRIC_6:
+ new_layout = ALGORITHM_LEFT_ASYMMETRIC;
+ break;
+ case ALGORITHM_RIGHT_ASYMMETRIC_6:
+ new_layout = ALGORITHM_RIGHT_ASYMMETRIC;
+ break;
+ case ALGORITHM_LEFT_SYMMETRIC_6:
+ new_layout = ALGORITHM_LEFT_SYMMETRIC;
+ break;
+ case ALGORITHM_RIGHT_SYMMETRIC_6:
+ new_layout = ALGORITHM_RIGHT_SYMMETRIC;
+ break;
+ case ALGORITHM_PARITY_0_6:
+ new_layout = ALGORITHM_PARITY_0;
+ break;
+ case ALGORITHM_PARITY_N:
+ new_layout = ALGORITHM_PARITY_N;
+ break;
+ default:
+ return ERR_PTR(-EINVAL);
+ }
+ mddev->new_level = 5;
+ mddev->new_layout = new_layout;
+ mddev->delta_disks = -1;
+ mddev->raid_disks -= 1;
+ return setup_conf(mddev);
+}
+
static int raid5_reconfig(mddev_t *mddev, int new_layout, int new_chunk)
{
@@ -4972,6 +5005,8 @@ static void *raid5_takeover(mddev_t *mddev)
mddev->new_level = 5;
return setup_conf(mddev);
}
+ if (mddev->level == 6)
+ return raid5_takeover_raid6(mddev);
return ERR_PTR(-EINVAL);
}