diff options
author | NeilBrown <neilb@suse.de> | 2010-03-22 05:53:49 (GMT) |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2010-05-18 05:27:49 (GMT) |
commit | a78d38a1a16c8e009aa512caa71d483757fefc1c (patch) | |
tree | 028ba0f1d0d6a18b2710ece1f24639f9ff72e3d2 /drivers/md | |
parent | 5cac7861b2de95a1f714ebdc652813abd0afcc73 (diff) | |
download | linux-a78d38a1a16c8e009aa512caa71d483757fefc1c.tar.xz |
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 bb28fd6..020143d 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -5788,6 +5788,18 @@ static void *raid5_takeover(mddev_t *mddev) return ERR_PTR(-EINVAL); } +static void *raid4_takeover(mddev_t *mddev) +{ + /* raid4 can take over raid5 if layout is right. + */ + if (mddev->level == 5 && + mddev->layout == ALGORITHM_PARITY_N) { + mddev->new_layout = 0; + mddev->new_level = 4; + return setup_conf(mddev); + } + return ERR_PTR(-EINVAL); +} static struct mdk_personality raid5_personality; @@ -5903,6 +5915,7 @@ static struct mdk_personality raid4_personality = .start_reshape = raid5_start_reshape, .finish_reshape = raid5_finish_reshape, .quiesce = raid5_quiesce, + .takeover = raid4_takeover, }; static int __init raid5_init(void) |