mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
2b7da309ff
commit
3b71bd9337
|
@ -5678,6 +5678,7 @@ static void raid5_quiesce(mddev_t *mddev, int state)
|
|||
static void *raid45_takeover_raid0(mddev_t *mddev, int level)
|
||||
{
|
||||
struct raid0_private_data *raid0_priv = mddev->private;
|
||||
unsigned long long sectors;
|
||||
|
||||
/* for raid0 takeover only one zone is supported */
|
||||
if (raid0_priv->nr_strip_zones > 1) {
|
||||
|
@ -5686,6 +5687,9 @@ static void *raid45_takeover_raid0(mddev_t *mddev, int level)
|
|||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
sectors = raid0_priv->strip_zone[0].zone_end;
|
||||
sector_div(sectors, raid0_priv->strip_zone[0].nb_dev);
|
||||
mddev->dev_sectors = sectors;
|
||||
mddev->new_level = level;
|
||||
mddev->new_layout = ALGORITHM_PARITY_N;
|
||||
mddev->new_chunk_sectors = mddev->chunk_sectors;
|
||||
|
|
Loading…
Reference in New Issue