mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
lvconvert: add segment type raid10_near
Introducing this alias for "raid10", avoid allocating reshape space when converting between them. Resolves: rhbz1441347
This commit is contained in:
parent
7bc85177b0
commit
01b5820d03
@ -1976,6 +1976,7 @@ static int _raid_reshape_remove_images(struct logical_volume *lv,
|
|||||||
* Reshape: keep images in RAID @lv but change stripe size or data copies
|
* Reshape: keep images in RAID @lv but change stripe size or data copies
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
static const char *_get_segtype_alias(const struct segment_type *segtype);
|
||||||
static int _raid_reshape_keep_images(struct logical_volume *lv,
|
static int _raid_reshape_keep_images(struct logical_volume *lv,
|
||||||
const struct segment_type *new_segtype,
|
const struct segment_type *new_segtype,
|
||||||
int yes, int force, int *force_repair,
|
int yes, int force, int *force_repair,
|
||||||
@ -1995,8 +1996,6 @@ static int _raid_reshape_keep_images(struct logical_volume *lv,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
seg->stripe_size = new_stripe_size;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reshape layout alogorithm or chunksize:
|
* Reshape layout alogorithm or chunksize:
|
||||||
*
|
*
|
||||||
@ -2010,8 +2009,22 @@ static int _raid_reshape_keep_images(struct logical_volume *lv,
|
|||||||
* The dm-raid target is able to use the space whereever it
|
* The dm-raid target is able to use the space whereever it
|
||||||
* is found by appropriately selecting forward or backward reshape.
|
* is found by appropriately selecting forward or backward reshape.
|
||||||
*/
|
*/
|
||||||
if (seg->area_count != 2 &&
|
if (seg->segtype != new_segtype) {
|
||||||
alloc_reshape_space &&
|
const char *alias = _get_segtype_alias(seg->segtype);
|
||||||
|
|
||||||
|
if (!strcmp(alias, new_segtype->name))
|
||||||
|
alloc_reshape_space = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (seg->stripe_size != new_stripe_size)
|
||||||
|
alloc_reshape_space = 1;
|
||||||
|
|
||||||
|
seg->stripe_size = new_stripe_size;
|
||||||
|
|
||||||
|
if (seg->area_count == 2)
|
||||||
|
alloc_reshape_space = 0;
|
||||||
|
|
||||||
|
if (alloc_reshape_space &&
|
||||||
!_lv_alloc_reshape_space(lv, where, NULL, allocate_pvs))
|
!_lv_alloc_reshape_space(lv, where, NULL, allocate_pvs))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -4411,6 +4424,12 @@ static const char *_get_segtype_alias(const struct segment_type *segtype)
|
|||||||
if (!strcmp(segtype->name, SEG_TYPE_NAME_RAID6_ZR))
|
if (!strcmp(segtype->name, SEG_TYPE_NAME_RAID6_ZR))
|
||||||
return SEG_TYPE_NAME_RAID6;
|
return SEG_TYPE_NAME_RAID6;
|
||||||
|
|
||||||
|
if (!strcmp(segtype->name, SEG_TYPE_NAME_RAID10))
|
||||||
|
return SEG_TYPE_NAME_RAID10_NEAR;
|
||||||
|
|
||||||
|
if (!strcmp(segtype->name, SEG_TYPE_NAME_RAID10_NEAR))
|
||||||
|
return SEG_TYPE_NAME_RAID10;
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||||
* Copyright (C) 2004-2016 Red Hat, Inc. All rights reserved.
|
* Copyright (C) 2004-2017 Red Hat, Inc. All rights reserved.
|
||||||
*
|
*
|
||||||
* This file is part of LVM2.
|
* This file is part of LVM2.
|
||||||
*
|
*
|
||||||
@ -89,6 +89,7 @@ struct dev_manager;
|
|||||||
#define SEG_TYPE_NAME_RAID0_META "raid0_meta"
|
#define SEG_TYPE_NAME_RAID0_META "raid0_meta"
|
||||||
#define SEG_TYPE_NAME_RAID1 "raid1"
|
#define SEG_TYPE_NAME_RAID1 "raid1"
|
||||||
#define SEG_TYPE_NAME_RAID10 "raid10"
|
#define SEG_TYPE_NAME_RAID10 "raid10"
|
||||||
|
#define SEG_TYPE_NAME_RAID10_NEAR "raid10_near"
|
||||||
#define SEG_TYPE_NAME_RAID4 "raid4"
|
#define SEG_TYPE_NAME_RAID4 "raid4"
|
||||||
#define SEG_TYPE_NAME_RAID5 "raid5"
|
#define SEG_TYPE_NAME_RAID5 "raid5"
|
||||||
#define SEG_TYPE_NAME_RAID5_N "raid5_n"
|
#define SEG_TYPE_NAME_RAID5_N "raid5_n"
|
||||||
@ -137,11 +138,12 @@ struct dev_manager;
|
|||||||
#define segtype_is_raid6_rs_6(segtype) ((segtype)->flags & SEG_RAID6_RS_6 ? 1 : 0)
|
#define segtype_is_raid6_rs_6(segtype) ((segtype)->flags & SEG_RAID6_RS_6 ? 1 : 0)
|
||||||
#define segtype_is_raid6_la_6(segtype) ((segtype)->flags & SEG_RAID6_LA_6 ? 1 : 0)
|
#define segtype_is_raid6_la_6(segtype) ((segtype)->flags & SEG_RAID6_LA_6 ? 1 : 0)
|
||||||
#define segtype_is_raid6_ra_6(segtype) ((segtype)->flags & SEG_RAID6_RA_6 ? 1 : 0)
|
#define segtype_is_raid6_ra_6(segtype) ((segtype)->flags & SEG_RAID6_RA_6 ? 1 : 0)
|
||||||
#define segtype_is_any_raid10(segtype) ((segtype)->flags & SEG_RAID10 ? 1 : 0)
|
|
||||||
#define segtype_is_raid10(segtype) ((segtype)->flags & SEG_RAID10 ? 1 : 0)
|
#define segtype_is_raid10(segtype) ((segtype)->flags & SEG_RAID10 ? 1 : 0)
|
||||||
#define segtype_is_raid10_near(segtype) segtype_is_raid10(segtype)
|
#define segtype_is_raid10_near(segtype) ((segtype)->flags & SEG_RAID10_NEAR ? 1 : 0)
|
||||||
/* FIXME: once raid10_offset supported */
|
/* FIXME: once raid10_{far,offset} supported */
|
||||||
|
#define segtype_is_raid10_far(segtype) 0 /* FIXME ((segtype)->flags & SEG_RAID10_FAR ? 1 : 0 */
|
||||||
#define segtype_is_raid10_offset(segtype) 0 /* FIXME ((segtype)->flags & SEG_RAID10_OFFSET ? 1 : 0 */
|
#define segtype_is_raid10_offset(segtype) 0 /* FIXME ((segtype)->flags & SEG_RAID10_OFFSET ? 1 : 0 */
|
||||||
|
#define segtype_is_any_raid10(segtype) (segtype_is_raid10(segtype) || segtype_is_raid10_near(segtype) || segtype_is_raid10_far(segtype) || segtype_is_raid10_offset(segtype))
|
||||||
#define segtype_is_raid_with_meta(segtype) (segtype_is_raid(segtype) && !segtype_is_raid0(segtype))
|
#define segtype_is_raid_with_meta(segtype) (segtype_is_raid(segtype) && !segtype_is_raid0(segtype))
|
||||||
#define segtype_is_striped_raid(segtype) (segtype_is_raid(segtype) && !segtype_is_raid1(segtype))
|
#define segtype_is_striped_raid(segtype) (segtype_is_raid(segtype) && !segtype_is_raid1(segtype))
|
||||||
#define segtype_is_reshapable_raid(segtype) ((segtype_is_striped_raid(segtype) && !segtype_is_any_raid0(segtype)) || segtype_is_raid10_near(segtype) || segtype_is_raid10_offset(segtype))
|
#define segtype_is_reshapable_raid(segtype) ((segtype_is_striped_raid(segtype) && !segtype_is_any_raid0(segtype)) || segtype_is_raid10_near(segtype) || segtype_is_raid10_offset(segtype))
|
||||||
|
@ -599,6 +599,7 @@ static const struct raid_type {
|
|||||||
{ SEG_TYPE_NAME_RAID0_META, 0, SEG_RAID0_META | SEG_AREAS_STRIPED },
|
{ SEG_TYPE_NAME_RAID0_META, 0, SEG_RAID0_META | SEG_AREAS_STRIPED },
|
||||||
{ SEG_TYPE_NAME_RAID1, 0, SEG_RAID1 | SEG_AREAS_MIRRORED },
|
{ SEG_TYPE_NAME_RAID1, 0, SEG_RAID1 | SEG_AREAS_MIRRORED },
|
||||||
{ SEG_TYPE_NAME_RAID10, 0, SEG_RAID10 | SEG_AREAS_MIRRORED },
|
{ SEG_TYPE_NAME_RAID10, 0, SEG_RAID10 | SEG_AREAS_MIRRORED },
|
||||||
|
{ SEG_TYPE_NAME_RAID10_NEAR,0, SEG_RAID10_NEAR | SEG_AREAS_MIRRORED },
|
||||||
{ SEG_TYPE_NAME_RAID4, 1, SEG_RAID4 },
|
{ SEG_TYPE_NAME_RAID4, 1, SEG_RAID4 },
|
||||||
{ SEG_TYPE_NAME_RAID5, 1, SEG_RAID5 },
|
{ SEG_TYPE_NAME_RAID5, 1, SEG_RAID5 },
|
||||||
{ SEG_TYPE_NAME_RAID5_N, 1, SEG_RAID5_N },
|
{ SEG_TYPE_NAME_RAID5_N, 1, SEG_RAID5_N },
|
||||||
|
@ -108,6 +108,7 @@ static const struct {
|
|||||||
*/
|
*/
|
||||||
{ SEG_RAID5_LS, "raid5"}, /* same as "raid5_ls" (default for MD also) */
|
{ SEG_RAID5_LS, "raid5"}, /* same as "raid5_ls" (default for MD also) */
|
||||||
{ SEG_RAID6_ZR, "raid6"}, /* same as "raid6_zr" */
|
{ SEG_RAID6_ZR, "raid6"}, /* same as "raid6_zr" */
|
||||||
|
{ SEG_RAID10, "raid10_near"}, /* same as "raid10" */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Some segment types have a list of areas of other devices attached */
|
/* Some segment types have a list of areas of other devices attached */
|
||||||
|
Loading…
Reference in New Issue
Block a user