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

[lvm-devel] [RFC LVM2] (5/6) Allow merging AREA_LV striped segments



Currently, 'striped' segment can only be merged if the segment
is allocated from PV (AREA_PV).

This patch extends the mergeable check to cope with AREA_LV case.

Thanks,
-- 
Jun'ichi Nomura, NEC Corporation of America
Allow merging striped-LV segments

Index: LVM2.work/lib/striped/striped.c
===================================================================
--- LVM2.work.orig/lib/striped/striped.c
+++ LVM2.work/lib/striped/striped.c
@@ -111,20 +111,20 @@ static int _striped_segments_compatible(
 		return 0;
 
 	for (s = 0; s < first->area_count; s++) {
-
-		/* FIXME Relax this to first area type != second area type */
-		/*       plus the additional AREA_LV checks needed */
-		if ((seg_type(first, s) != AREA_PV) ||
-		    (seg_type(second, s) != AREA_PV))
+		if (seg_type(first, s) != seg_type(second, s))
 			return 0;
 
 		width = first->area_len;
 
-		if ((seg_pv(first, s) !=
-		     seg_pv(second, s)) ||
-		    (seg_pe(first, s) + width !=
-		     seg_pe(second, s)))
-			return 0;
+		if (seg_type(first, s) == AREA_PV) {
+			if ((seg_pv(first, s) != seg_pv(second, s)) ||
+			    (seg_pe(first, s) + width != seg_pe(second, s)))
+				return 0;
+		} else if (seg_type(first, s) == AREA_LV) {
+			if ((seg_lv(first, s) != seg_lv(second, s)) ||
+			    (seg_le(first, s) + width != seg_le(second, s)))
+				return 0;
+		}
 	}
 
 	if (!str_list_lists_equal(&first->tags, &second->tags))

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