mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
lvreduce: make _lvseg_get_stripes handle integrity layer
lvreduce uses _lvseg_get_stripes() which was unable to get raid stripe info with an integrity layer present. This caused lvreduce on a raid+integrity LV to fail prematurely when checking stripe parameters. An unhelpful error message about stripe size would be printed.
This commit is contained in:
parent
c4440b5b49
commit
368381fd40
@ -5144,22 +5144,39 @@ int lv_extend_policy_calculate_percent(struct logical_volume *lv,
|
|||||||
|
|
||||||
static uint32_t _lvseg_get_stripes(struct lv_segment *seg, uint32_t *stripesize)
|
static uint32_t _lvseg_get_stripes(struct lv_segment *seg, uint32_t *stripesize)
|
||||||
{
|
{
|
||||||
uint32_t s;
|
uint32_t s, a;
|
||||||
struct lv_segment *seg_mirr;
|
struct lv_segment *seg_get, *seg_image, *seg_iorig;
|
||||||
|
struct logical_volume *lv_image, *lv_iorig;
|
||||||
|
|
||||||
/* If segment mirrored, check if images are striped */
|
/* If segment mirrored, check if images are striped */
|
||||||
if (seg_is_mirrored(seg))
|
if (seg_is_mirrored(seg)) {
|
||||||
for (s = 0; s < seg->area_count; s++) {
|
for (s = 0; s < seg->area_count; s++) {
|
||||||
if (seg_type(seg, s) != AREA_LV)
|
if (seg_type(seg, s) != AREA_LV)
|
||||||
continue;
|
continue;
|
||||||
seg_mirr = first_seg(seg_lv(seg, s));
|
|
||||||
|
|
||||||
if (seg_is_striped(seg_mirr)) {
|
lv_image = seg_lv(seg, s);
|
||||||
seg = seg_mirr;
|
seg_image = first_seg(lv_image);
|
||||||
|
seg_get = NULL;
|
||||||
|
|
||||||
|
if (seg_is_integrity(seg_image)) {
|
||||||
|
/* Get stripe values from the iorig layer. */
|
||||||
|
for (a = 0; a < seg_image->area_count; a++) {
|
||||||
|
lv_iorig = seg_lv(seg_image, a);
|
||||||
|
seg_iorig = first_seg(lv_iorig);
|
||||||
|
seg_get = seg_iorig;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* Get stripe values from the image layer. */
|
||||||
|
seg_get = seg_image;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (seg_get && seg_is_striped(seg_get)) {
|
||||||
|
seg = seg_get;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (seg_is_striped(seg)) {
|
if (seg_is_striped(seg)) {
|
||||||
*stripesize = seg->stripe_size;
|
*stripesize = seg->stripe_size;
|
||||||
|
Loading…
Reference in New Issue
Block a user