1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-21 22:04:19 +03:00

raid_manip: use lv_create_single() in _lv_create()

fix size issue with lvreduce on raid10
This commit is contained in:
Heinz Mauelshagen 2015-09-25 20:48:43 +02:00
parent f1117f526d
commit 76f7b2dd0e
4 changed files with 279 additions and 256 deletions

View File

@ -1159,16 +1159,7 @@ PFLA("meta_area_reduction=%u" , meta_area_reduction);
!lv_reduce(mlv, meta_area_reduction))
return_0; /* FIXME: any upper level reporting */
}
#if 1
/* HM FIXME: find better way to go by mirrors=2 */
if (seg->lv) {
struct lv_segment *seg1 = first_seg(seg->lv);
if (seg1 && (seg_is_raid10(seg1)))
area_reduction *= seg->data_copies;
}
PFLA("lv=%s lv->le_count=%u seg=%p area_reduction=%u", lv->name, lv->le_count, seg, area_reduction);
#endif
if (!lv_reduce(lv, area_reduction))
return_0; /* FIXME: any upper level reporting */
@ -1335,7 +1326,7 @@ PFLA("segtype=%s stripes=%u data_copies=%u", seg->segtype->name, stripes, seg->d
r = lv_raid_rimage_extents(extents, stripes, seg->data_copies ?: 1);
} else
r= extents;
r = extents;
PFLA("area_len=%u", r);
@ -1382,7 +1373,7 @@ static int _lv_segment_reduce(struct lv_segment *seg, uint32_t reduction)
uint32_t area_reduction, s;
area_reduction = _area_len(seg, reduction);
PFLA("reduction=%u, area_reduction=%u", reduction, area_reduction);
PFLA("seg->lv=%s reduction=%u, area_reduction=%u", display_lvname(seg->lv), reduction, area_reduction);
/* Release extents from all segment areas */
for (s = 0; s < seg->area_count; s++)
@ -1408,7 +1399,8 @@ static uint32_t _calc_area_multiple(const struct segment_type *segtype,
if (!area_count)
return 1;
if (segtype_is_raid01(segtype))
if (segtype_is_raid1(segtype) ||
segtype_is_raid01(segtype))
return 1;
/* Striped */
@ -1535,7 +1527,7 @@ PFLA("seg->len=%u count=%u extents=%u", seg->len, count, extents);
} else
reduction = count;
PFLA("reduction=%u", reduction);
PFLA("seg->lv=%s reduction=%u", display_lvname(seg->lv), reduction);
if (!_lv_segment_reduce(seg, reduction))
return_0;

View File

@ -111,11 +111,8 @@ uint32_t lv_mirror_count(const struct logical_volume *lv)
seg = first_seg(lv);
/* FIXME: RAID10 only supports 2 copies right now */
if (seg_is_raid10_near(seg))
return 2;
if (seg_is_any_raid10(seg))
return 1;
return seg->data_copies;
if (lv_is_pvmove(lv))
return seg->area_count;

File diff suppressed because it is too large Load Diff

View File

@ -1817,7 +1817,7 @@ PFLA("lp->segtype=%s\n", lp->segtype->name);
if (seg_is_reshapable_raid(seg) || seg_is_raid1(seg))
seg->region_size = lp->region_size ?: 1024;
return lv_raid_convert(lv, lp->segtype, lp->yes, lp->force, arg_count(cmd, duplicate_ARG),
return lv_raid_convert(lv, lp->segtype, lp->yes, lp->force, arg_is_set(cmd, duplicate_ARG),
image_count, lp->mirrors + 1, stripes, stripe_size, lp->pvh);
}