Skip to contentSkip to conversation

dev-lvmguy-raid-takeover-reshape-resize - bz1168959: v2 fix replaced rimage allocation

PATCH Heinz Mauelshagen 1 participant 1 message Jan 31, 2015

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f8e0b7b75afd379b69bc9efb0b2767b5a139a132
Commit:        f8e0b7b75afd379b69bc9efb0b2767b5a139a132
Parent:        df53bd845aeeedee83776a6fe63ce704d788f8f2
Author:        Heinz Mauelshagen <[email protected]>
AuthorDate:    Fri Jan 16 13:05:12 2015 +0100
Committer:     Heinz Mauelshagen <[email protected]>
CommitterDate: Fri Jan 16 13:05:12 2015 +0100

bz1168959: v2 fix replaced rimage allocation

---
 lib/metadata/metadata-exported.h |    6 +-
 lib/metadata/pv_map.c            |    5 +-
 lib/metadata/raid_manip.c        |  284 +++++++++++++++++++++++++-------------
 lib/metadata/segtype.h           |    2 +
 4 files changed, 202 insertions(+), 95 deletions(-)
lib/metadata/metadata-exported.h +5 -1
index 0fe83bf..a48f31b 100644
@@ -122,7 +122,11 @@
 #define LV_RESHAPE_DELTA_DISKS_PLUS		UINT64_C(0x0008000000000000)    /* LV reshape flag delta disks plus image(s) */
 #define LV_RESHAPE_DELTA_DISKS_MINUS		UINT64_C(0x0010000000000000)    /* LV reshape flag delta disks minus image(s) */
 
-/* Next unused flag:		UINT64_C(0x0020000000000000)    */
+#define PV_ALLOCATION_PROHIBITED	UINT64_C(0x0020000000000000)	/* PV - internal use only - allocation prohibited
+									e.g. to prohibit allocation of a RAID image
+									on a PV already holing an image of the RAID set */
+
+/* Next unused flag:		UINT64_C(0x0040000000000000)    */
 
 /* Format features flags */
 #define FMT_SEGMENTS		0x00000001U	/* Arbitrary segment params? */
lib/metadata/pv_map.c +4 -1
index 4423a7d..db9f84e 100644
@@ -133,8 +133,11 @@ static int _create_maps(struct dm_pool *mem, struct dm_list *pvs, struct dm_list
 	struct pv_list *pvl;
 
 	dm_list_iterate_items(pvl, pvs) {
-		if (!(pvl->pv->status & ALLOCATABLE_PV))
+		if (!(pvl->pv->status & ALLOCATABLE_PV) ||
+		    (pvl->pv->status & PV_ALLOCATION_PROHIBITED)) {
+			pvl->pv->status &= ~PV_ALLOCATION_PROHIBITED;
 			continue;
+		}
 		if (is_missing_pv(pvl->pv))
 			continue;
 		assert(pvl->pv->dev);
lib/metadata/raid_manip.c +191 -93

371 lines not on this page · raw message

lib/metadata/segtype.h +2 -0
index 509de96..dd60c38 100644
@@ -156,6 +156,8 @@ struct segment_type *init_unknown_segtype(struct cmd_context *cmd,
 int init_raid_segtypes(struct cmd_context *cmd, struct segtype_library *seglib);
 #endif
 
+#define SEG_TYPE_NAME_STRIPED		"striped"
+
 #define SEG_TYPE_NAME_RAID0		"raid0"
 #define SEG_TYPE_NAME_RAID1		"raid1"
 #define SEG_TYPE_NAME_RAID10		"raid10"