1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

raid_manip: fix data copies on mirror <-> raid1 conversions

This commit is contained in:
Heinz Mauelshagen 2016-02-04 14:28:58 +01:00
parent 10f5c83851
commit 6a182bf338
2 changed files with 6 additions and 2 deletions

View File

@ -4452,6 +4452,9 @@ int lv_extend(struct logical_volume *lv,
return 0;
}
if (segtype_is_mirrored(segtype) || segtype_is_raid1(segtype))
stripes = 1;
log_very_verbose("Adding segment of type %s to LV %s.", segtype->name, display_lvname(lv));
PFLA("extents=%u", extents);
#if 1
@ -5686,8 +5689,7 @@ PFL();
#if 1
/* HM FIXME: sufficient for RAID? */
if (seg_is_raid(seg) &&
!seg_is_raid1(seg)) {
if (seg_is_striped_raid(seg)) {
unsigned stripes = seg->area_count - seg->segtype->parity_devs;
lp->extents = _round_to_stripe_boundary(lv, lp->extents, stripes,

View File

@ -3731,6 +3731,7 @@ static int _convert_mirror_to_raid(struct logical_volume *lv,
init_mirror_in_sync(1);
seg->segtype = new_segtype;
seg->data_copies = new_image_count;
lv->status &= ~(MIRROR | MIRRORED);
lv->status |= RAID;
seg->status |= RAID;
@ -3805,6 +3806,7 @@ static int _convert_raid1_to_mirror(struct logical_volume *lv,
seg->segtype = new_segtype;
seg->region_size = new_region_size;
seg->data_copies = new_image_count;
lv->status &= ~RAID;
seg->status &= ~RAID;
lv->status |= (MIRROR | MIRRORED);