1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

raid: add data_offset incompatibility segment type flag

In order to reject out of place reshaping with segment data_offset
field on old runtime, add a respective segment type incompatibility
flag causing "+RESHAPE_DATA_OFFSET" to be suffixed to the segment
type name.
This commit is contained in:
Heinz Mauelshagen 2017-07-14 15:52:18 +02:00
parent 1d69fc7c5e
commit 34504855a7
3 changed files with 8 additions and 1 deletions

View File

@ -63,6 +63,7 @@ static const struct flag _lv_flags[] = {
{LV_NOTSYNCED, "NOTSYNCED", STATUS_FLAG},
{LV_REBUILD, "REBUILD", STATUS_FLAG},
{LV_RESHAPE, "RESHAPE", SEGTYPE_FLAG},
{LV_RESHAPE_DATA_OFFSET, "RESHAPE_DATA_OFFSET", SEGTYPE_FLAG},
{LV_RESHAPE_DELTA_DISKS_PLUS, "RESHAPE_DELTA_DISKS_PLUS", SEGTYPE_FLAG},
{LV_RESHAPE_DELTA_DISKS_MINUS, "RESHAPE_DELTA_DISKS_MINUS", SEGTYPE_FLAG},
{LV_REMOVE_AFTER_RESHAPE, "REMOVE_AFTER_RESHAPE", SEGTYPE_FLAG},

View File

@ -145,7 +145,8 @@
#define LV_RESHAPE UINT64_C(0x1000000000000000) /* Ongoing reshape (number of stripes, stripesize or raid algorithm change):
used as SEGTYPE_FLAG to prevent activation on old runtime */
/* Next unused flag: UINT64_C(0x2000000000000000) */
#define LV_RESHAPE_DATA_OFFSET UINT64_C(0x2000000000000000) /* LV reshape flag data offset (out of place reshaping) */
/* Next unused flag: UINT64_C(0x4000000000000000) */
/* Format features flags */
#define FMT_SEGMENTS 0x00000001U /* Arbitrary segment params? */

View File

@ -1636,6 +1636,9 @@ static int _lv_alloc_reshape_space(struct logical_volume *lv,
/* Update and reload mapping for proper size of data SubLVs in the cluster */
if (!lv_update_and_reload(lv))
return_0;
/* Define out of place reshape (used as SEGTYPE_FLAG to avoid incompatible activations on old runtime) */
lv->status |= LV_RESHAPE_DATA_OFFSET;
}
/* Preset data offset in case we fail relocating reshape space below */
@ -1729,6 +1732,8 @@ static int _lv_free_reshape_space_with_status(struct logical_volume *lv, enum al
if (!_lv_set_reshape_len(lv, 0))
return_0;
lv->status &= ~LV_RESHAPE_DATA_OFFSET;
} else if (where_it_was)
*where_it_was = alloc_none;