aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid5.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2009-03-30 23:57:20 -0400
committerNeilBrown <neilb@suse.de>2009-03-30 23:57:20 -0400
commitfc9739c6d626ee79a148ec367d143b0601299a9d (patch)
tree492a3a29fe44fdd99d9177bef77b16a463a771f9 /drivers/md/raid5.c
parente9d4758f6e93488dc719a1445ce54659a570938f (diff)
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/md/raid5.c')
-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}