diff options
author | NeilBrown <neilb@suse.de> | 2010-03-22 01:53:49 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2010-05-18 01:27:49 -0400 |
commit | a78d38a1a16c8e009aa512caa71d483757fefc1c (patch) | |
tree | 028ba0f1d0d6a18b2710ece1f24639f9ff72e3d2 /drivers/md | |
parent | 5cac7861b2de95a1f714ebdc652813abd0afcc73 (diff) |
md: add support for raid5 to raid4 conversion
This is unlikely to be wanted, but we may as well provide it
for completeness.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/raid5.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index bb28fd6b44fe..020143dec180 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -5788,6 +5788,18 @@ static void *raid5_takeover(mddev_t *mddev) | |||
5788 | return ERR_PTR(-EINVAL); | 5788 | return ERR_PTR(-EINVAL); |
5789 | } | 5789 | } |
5790 | 5790 | ||
5791 | static void *raid4_takeover(mddev_t *mddev) | ||
5792 | { | ||
5793 | /* raid4 can take over raid5 if layout is right. | ||
5794 | */ | ||
5795 | if (mddev->level == 5 && | ||
5796 | mddev->layout == ALGORITHM_PARITY_N) { | ||
5797 | mddev->new_layout = 0; | ||
5798 | mddev->new_level = 4; | ||
5799 | return setup_conf(mddev); | ||
5800 | } | ||
5801 | return ERR_PTR(-EINVAL); | ||
5802 | } | ||
5791 | 5803 | ||
5792 | static struct mdk_personality raid5_personality; | 5804 | static struct mdk_personality raid5_personality; |
5793 | 5805 | ||
@@ -5903,6 +5915,7 @@ static struct mdk_personality raid4_personality = | |||
5903 | .start_reshape = raid5_start_reshape, | 5915 | .start_reshape = raid5_start_reshape, |
5904 | .finish_reshape = raid5_finish_reshape, | 5916 | .finish_reshape = raid5_finish_reshape, |
5905 | .quiesce = raid5_quiesce, | 5917 | .quiesce = raid5_quiesce, |
5918 | .takeover = raid4_takeover, | ||
5906 | }; | 5919 | }; |
5907 | 5920 | ||
5908 | static int __init raid5_init(void) | 5921 | static int __init raid5_init(void) |