master - raid: add data_offset incompatibility segment type flag
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=34504855a70772e1de3f117a9a610860ead80981 Commit: 34504855a70772e1de3f117a9a610860ead80981 Parent: 1d69fc7c5e8ed301817253f6c8a9f8e806015a03 Author: Heinz Mauelshagen <[email protected]> AuthorDate: Fri Jul 14 15:52:18 2017 +0200 Committer: Heinz Mauelshagen <[email protected]> CommitterDate: Fri Jul 14 15:53:23 2017 +0200
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.
--- lib/format_text/flags.c | 1 + lib/metadata/metadata-exported.h | 3 ++- lib/metadata/raid_manip.c | 5 +++++ 3 files changed, 8 insertions(+), 1 deletions(-)
lib/format_text/flags.c +1 -0
@@ -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},
lib/metadata/metadata-exported.h +2 -1
@@ -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? */
lib/metadata/raid_manip.c +5 -0
@@ -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 alif (!_lv_set_reshape_len (lv,0 )) return_0; + lv->status &= ~LV_RESHAPE_DATA_OFFSET ; + }else if (where_it_was) *where_it_was = alloc_none;