aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid5.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2011-04-20 01:38:18 -0400
committerNeilBrown <neilb@suse.de>2011-04-20 01:38:18 -0400
commit3b71bd9337b404baab5c894e066be6b6bf51b1c3 (patch)
tree23d29cf358319194092c41ed4748908e1b301180 /drivers/md/raid5.c
parent2b7da309ffe602d222558cee4d7e407b96e34b3a (diff)
md: Fix dev_sectors on takeover from raid0 to raid4/5
A raid0 array doesn't set 'dev_sectors' as each device might contribute a different number of sectors. So when converting to a RAID4 or RAID5 we need to set dev_sectors as they need the number. We have already verified that in fact all devices do contribute the same number of sectors, so use that number. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r--drivers/md/raid5.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 179bdfc4d03a..fd500112f13e 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -5678,6 +5678,7 @@ static void raid5_quiesce(mddev_t *mddev, int state)
5678static void *raid45_takeover_raid0(mddev_t *mddev, int level) 5678static void *raid45_takeover_raid0(mddev_t *mddev, int level)
5679{ 5679{
5680 struct raid0_private_data *raid0_priv = mddev->private; 5680 struct raid0_private_data *raid0_priv = mddev->private;
5681 unsigned long long sectors;
5681 5682
5682 /* for raid0 takeover only one zone is supported */ 5683 /* for raid0 takeover only one zone is supported */
5683 if (raid0_priv->nr_strip_zones > 1) { 5684 if (raid0_priv->nr_strip_zones > 1) {
@@ -5686,6 +5687,9 @@ static void *raid45_takeover_raid0(mddev_t *mddev, int level)
5686 return ERR_PTR(-EINVAL); 5687 return ERR_PTR(-EINVAL);
5687 } 5688 }
5688 5689
5690 sectors = raid0_priv->strip_zone[0].zone_end;
5691 sector_div(sectors, raid0_priv->strip_zone[0].nb_dev);
5692 mddev->dev_sectors = sectors;
5689 mddev->new_level = level; 5693 mddev->new_level = level;
5690 mddev->new_layout = ALGORITHM_PARITY_N; 5694 mddev->new_layout = ALGORITHM_PARITY_N;
5691 mddev->new_chunk_sectors = mddev->chunk_sectors; 5695 mddev->new_chunk_sectors = mddev->chunk_sectors;