aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid5.c
diff options
context:
space:
mode:
authorTrela Maciej <Maciej.Trela@intel.com>2010-03-08 00:02:42 -0500
committerNeilBrown <neilb@suse.de>2010-05-18 01:27:47 -0400
commit54071b3808ee3dc8624d9d6f1b06c4fd5308fa3b (patch)
treeb254ce6625ce3dd472faac0d59edeb9589b30f2b /drivers/md/raid5.c
parent84707f38e767ac470fd82af6c45a8cafe2bd1b9a (diff)
md:Add support for Raid0->Raid5 takeover
Signed-off-by: Maciej Trela <maciej.trela@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r--drivers/md/raid5.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 10af3715b1fc..bb28fd6b44fe 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -52,6 +52,7 @@
52#include <linux/cpu.h> 52#include <linux/cpu.h>
53#include "md.h" 53#include "md.h"
54#include "raid5.h" 54#include "raid5.h"
55#include "raid0.h"
55#include "bitmap.h" 56#include "bitmap.h"
56 57
57/* 58/*
@@ -5619,6 +5620,21 @@ static void raid5_quiesce(mddev_t *mddev, int state)
5619} 5620}
5620 5621
5621 5622
5623static void *raid5_takeover_raid0(mddev_t *mddev)
5624{
5625
5626 mddev->new_level = 5;
5627 mddev->new_layout = ALGORITHM_PARITY_N;
5628 mddev->new_chunk_sectors = mddev->chunk_sectors;
5629 mddev->raid_disks += 1;
5630 mddev->delta_disks = 1;
5631 /* make sure it will be not marked as dirty */
5632 mddev->recovery_cp = MaxSector;
5633
5634 return setup_conf(mddev);
5635}
5636
5637
5622static void *raid5_takeover_raid1(mddev_t *mddev) 5638static void *raid5_takeover_raid1(mddev_t *mddev)
5623{ 5639{
5624 int chunksect; 5640 int chunksect;
@@ -5748,6 +5764,16 @@ static void *raid5_takeover(mddev_t *mddev)
5748 * raid4 - trivial - just use a raid4 layout. 5764 * raid4 - trivial - just use a raid4 layout.
5749 * raid6 - Providing it is a *_6 layout 5765 * raid6 - Providing it is a *_6 layout
5750 */ 5766 */
5767 if (mddev->level == 0) {
5768 /* for raid0 takeover only one zone is supported */
5769 struct raid0_private_data *raid0_priv
5770 = mddev->private;
5771 if (raid0_priv->nr_strip_zones > 1) {
5772 printk(KERN_ERR "md: cannot takeover raid 0 with more than one zone.\n");
5773 return ERR_PTR(-EINVAL);
5774 }
5775 return raid5_takeover_raid0(mddev);
5776 }
5751 5777
5752 if (mddev->level == 1) 5778 if (mddev->level == 1)
5753 return raid5_takeover_raid1(mddev); 5779 return raid5_takeover_raid1(mddev);