aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 95953273c4d9..70b50af2bcd7 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -4912,6 +4912,39 @@ static void *raid5_takeover_raid1(mddev_t *mddev)
4912 return setup_conf(mddev); 4912 return setup_conf(mddev);
4913} 4913}
4914 4914
4915static void *raid5_takeover_raid6(mddev_t *mddev)
4916{
4917 int new_layout;
4918
4919 switch (mddev->layout) {
4920 case ALGORITHM_LEFT_ASYMMETRIC_6:
4921 new_layout = ALGORITHM_LEFT_ASYMMETRIC;
4922 break;
4923 case ALGORITHM_RIGHT_ASYMMETRIC_6:
4924 new_layout = ALGORITHM_RIGHT_ASYMMETRIC;
4925 break;
4926 case ALGORITHM_LEFT_SYMMETRIC_6:
4927 new_layout = ALGORITHM_LEFT_SYMMETRIC;
4928 break;
4929 case ALGORITHM_RIGHT_SYMMETRIC_6:
4930 new_layout = ALGORITHM_RIGHT_SYMMETRIC;
4931 break;
4932 case ALGORITHM_PARITY_0_6:
4933 new_layout = ALGORITHM_PARITY_0;
4934 break;
4935 case ALGORITHM_PARITY_N:
4936 new_layout = ALGORITHM_PARITY_N;
4937 break;
4938 default:
4939 return ERR_PTR(-EINVAL);
4940 }
4941 mddev->new_level = 5;
4942 mddev->new_layout = new_layout;
4943 mddev->delta_disks = -1;
4944 mddev->raid_disks -= 1;
4945 return setup_conf(mddev);
4946}
4947
4915 4948
4916static int raid5_reconfig(mddev_t *mddev, int new_layout, int new_chunk) 4949static int raid5_reconfig(mddev_t *mddev, int new_layout, int new_chunk)
4917{ 4950{
@@ -4972,6 +5005,8 @@ static void *raid5_takeover(mddev_t *mddev)
4972 mddev->new_level = 5; 5005 mddev->new_level = 5;
4973 return setup_conf(mddev); 5006 return setup_conf(mddev);
4974 } 5007 }
5008 if (mddev->level == 6)
5009 return raid5_takeover_raid6(mddev);
4975 5010
4976 return ERR_PTR(-EINVAL); 5011 return ERR_PTR(-EINVAL);
4977} 5012}