[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] [RFC LVM2] (4/6) Add 'pvseg' to AREA_LV lv_segment_area



Currently, struct lv_segment_area has a union member and
switches by its type (AREA_PV or AREA_LV).

As a preparation for the patch "(6/6) Allow allocation from LV",
where AREA_LV segment may have pv_segment, this patch changes
struct lv_segment_area.

Thanks,
-- 
Jun'ichi Nomura, NEC Corporation of America
Allow AREA_LV to have pvseg
(preparation for allocation-from-lv patch)

Index: LVM2.work/lib/metadata/metadata.h
===================================================================
--- LVM2.work.orig/lib/metadata/metadata.h
+++ LVM2.work/lib/metadata/metadata.h
@@ -132,10 +132,10 @@ struct metadata_area {
 	void *metadata_locn;
 };
 
-#define seg_pvseg(seg, s)	(seg)->areas[(s)].u.pv.pvseg
-#define seg_dev(seg, s)		(seg)->areas[(s)].u.pv.pvseg->pv->dev
-#define seg_pe(seg, s)		(seg)->areas[(s)].u.pv.pvseg->pe
-#define seg_le(seg, s)		(seg)->areas[(s)].u.lv.le
+#define seg_pvseg(seg, s)	(seg)->areas[(s)].pvseg
+#define seg_dev(seg, s)		(seg)->areas[(s)].pvseg->pv->dev
+#define seg_pe(seg, s)		(seg)->areas[(s)].pvseg->pe
+#define seg_le(seg, s)		(seg)->areas[(s)].le
 
 struct name_list {
 	struct list list;
Index: LVM2.work/lib/metadata/metadata-exported.h
===================================================================
--- LVM2.work.orig/lib/metadata/metadata-exported.h
+++ LVM2.work/lib/metadata/metadata-exported.h
@@ -200,15 +202,11 @@ struct volume_group {
 /* There will be one area for each stripe */
 struct lv_segment_area {
 	area_type_t type;
-	union {
-		struct {
-			struct pv_segment *pvseg;
-		} pv;
-		struct {
-			struct logical_volume *lv;
-			uint32_t le;
-		} lv;
-	} u;
+	/* for AREA_PV and AREA_LV of stacked LV */
+	struct pv_segment *pvseg;
+	/* for AREA_LV */
+	struct logical_volume *lv;
+	uint32_t le;
 };
 
 struct segment_type;
@@ -241,8 +239,8 @@ struct lv_segment {
 };
 
 #define seg_type(seg, s)	(seg)->areas[(s)].type
-#define seg_pv(seg, s)		(seg)->areas[(s)].u.pv.pvseg->pv
-#define seg_lv(seg, s)		(seg)->areas[(s)].u.lv.lv
+#define seg_pv(seg, s)		(seg)->areas[(s)].pvseg->pv
+#define seg_lv(seg, s)		(seg)->areas[(s)].lv
 
 struct logical_volume {
 	union lvid lvid;

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]