summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinz Mauelshagen <heinzm@redhat.com>2015-10-02 17:09:37 +0200
committerHeinz Mauelshagen <heinzm@redhat.com>2015-10-02 17:09:37 +0200
commitb33d7586e7f629818e881e26677f4431a47d50b5 (patch)
tree6f0e25226f8f9096386120085ab5c429ab3f49ec
parentfb957ef3223939424cf1faff4ca9dd104882ab46 (diff)
downloadlvm2-b33d7586e7f629818e881e26677f4431a47d50b5.tar.gz
raid_manip: fix wrong image size allocation on raid10 "lvconvert --replace ..."
-rw-r--r--lib/metadata/raid_manip.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 5919e3b26..c420733ab 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -460,9 +460,12 @@ static int _alloc_image_components(struct logical_volume *lv,
* individual devies, we must specify how large the individual device
* is along with the number we want ('count').
*/
- extents = (segtype->parity_devs) ?
- (lv->le_count / (seg->area_count - segtype->parity_devs)) :
- lv->le_count;
+ if (segtype_is_raid10(segtype))
+ extents = lv->le_count / (seg->area_count / 2); /* we enforce 2 mirrors right now */
+ else
+ extents = (segtype->parity_devs) ?
+ (lv->le_count / (seg->area_count - segtype->parity_devs)) :
+ lv->le_count;
if (!(ah = allocate_extents(lv->vg, NULL, segtype, 0, count, count,
region_size, extents, pvs,