Skip to content

Commit

Permalink
md: add support for raid5 to raid4 conversion
Browse files Browse the repository at this point in the history
This is unlikely to be wanted, but we may as well provide it
for completeness.

Signed-off-by: NeilBrown <neilb@suse.de>
  • Loading branch information
NeilBrown committed May 18, 2010
1 parent 5cac786 commit a78d38a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions drivers/md/raid5.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a78d38a

Please sign in to comment.