Skip to contentSkip to conversation

LVM2/lib/metadata lv_manip.c

PATCH [email protected] 1 participant 1 message Nov 4, 2011

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac at sourceware.org 2011-11-04 22:45:52

Modified files:
lib/metadata : lv_manip.c

Log message:
Thin pool allocation simplified

Support allocation of metadata from the same PV, if the VG is build only from one PV.

As thinp is not mirror - we do not require 2 PVs for basic thin usage as user is losing only perfomance.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.322&r2=1.323

lib/metadata/lv_manip.c +7 -2
@@ -2568,10 +2568,15 @@
 	if (segtype_is_virtual(segtype))
 		return lv_add_virtual_segment(lv, 0u, extents, segtype, thin_pool_name);
 
-	if (!lv->le_count && segtype_is_thin_pool(segtype))
+	if (!lv->le_count && segtype_is_thin_pool(segtype)) {
+		if (stripes == 1 && (dm_list_size(allocatable_pvs) == 1)) {
+			log_warn("WARNING: Only one PV available for thin pool data and metadata.");
+			alloc = ALLOC_ANYWHERE;
+		}
 		/* Thin pool allocation treats its metadata device like a mirror log. */
+		/* TODO: add support for stripped metadata pool */
 		log_count = 1;
-	else if (segtype_is_raid(segtype) && !lv->le_count)
+	} else if (segtype_is_raid(segtype) && !lv->le_count)
 		log_count = mirrors * stripes;
 
 	if (!(ah = allocate_extents(lv->vg, lv, segtype, stripes, mirrors,