public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 doc/example.conf.in lib/config/defaults.h ...
@ 2011-12-21 13:10 zkabelac
  0 siblings, 0 replies; 2+ messages in thread
From: zkabelac @ 2011-12-21 13:10 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2011-12-21 13:10:53

Modified files:
	doc            : example.conf.in 
	lib/config     : defaults.h 
	tools          : lvresize.c 

Log message:
	Thin automatic policy based extension

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/doc/example.conf.in.diff?cvsroot=lvm2&r1=1.39&r2=1.40
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/defaults.h.diff?cvsroot=lvm2&r1=1.91&r2=1.92
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvresize.c.diff?cvsroot=lvm2&r1=1.144&r2=1.145

--- LVM2/doc/example.conf.in	2011/12/21 13:08:13	1.39
+++ LVM2/doc/example.conf.in	2011/12/21 13:10:52	1.40
@@ -603,6 +603,25 @@
     snapshot_autoextend_threshold = 100
     snapshot_autoextend_percent = 20
 
+    # 'thin_pool_autoextend_threshold' and 'thin_pool_autoextend_percent' define
+    # how to handle automatic pool extension. The former defines when the
+    # pool should be extended: when its space usage exceeds this many
+    # percent. The latter defines how much extra space should be allocated for
+    # the pool, in percent of its current size.
+    #
+    # For example, if you set thin_pool_autoextend_threshold to 70 and
+    # thin_pool_autoextend_percent to 20, whenever a pool exceeds 70% usage,
+    # it will be extended by another 20%. For a 1G pool, using up 700M will
+    # trigger a resize to 1.2G. When the usage exceeds 840M, the pool will
+    # be extended to 1.44G, and so on.
+    #
+    # Setting thin_pool_autoextend_threshold to 100 disables automatic
+    # extensions. The minimum value is 50 (A setting below 50 will be treated
+    # as 50).
+
+    thin_pool_autoextend_threshold = 100
+    thin_pool_autoextend_percent = 20
+
     # While activating devices, I/O to devices being (re)configured is
     # suspended, and as a precaution against deadlocks, LVM2 needs to pin
     # any memory it is using so it is not paged out.  Groups of pages that
--- LVM2/lib/config/defaults.h	2011/12/21 13:08:13	1.91
+++ LVM2/lib/config/defaults.h	2011/12/21 13:10:52	1.92
@@ -170,5 +170,7 @@
 #define DEFAULT_MIRROR_LOG_FAULT_POLICY "allocate"
 #define DEFAULT_SNAPSHOT_AUTOEXTEND_THRESHOLD 100
 #define DEFAULT_SNAPSHOT_AUTOEXTEND_PERCENT 20
+#define DEFAULT_THIN_POOL_AUTOEXTEND_THRESHOLD 100
+#define DEFAULT_THIN_POOL_AUTOEXTEND_PERCENT 20
 
 #endif				/* _LVM_DEFAULTS_H */
--- LVM2/tools/lvresize.c	2011/12/01 00:13:16	1.144
+++ LVM2/tools/lvresize.c	2011/12/21 13:10:53	1.145
@@ -285,23 +285,40 @@
 	percent_t percent;
 	int policy_threshold, policy_amount;
 
-	policy_threshold =
-		find_config_tree_int(cmd, "activation/snapshot_autoextend_threshold",
-				     DEFAULT_SNAPSHOT_AUTOEXTEND_THRESHOLD) * PERCENT_1;
-	policy_amount =
-		find_config_tree_int(cmd, "activation/snapshot_autoextend_percent",
-				     DEFAULT_SNAPSHOT_AUTOEXTEND_PERCENT);
+	if (lv_is_thin_pool(lv)) {
+		policy_threshold =
+			find_config_tree_int(cmd, "activation/thin_pool_autoextend_threshold",
+					     DEFAULT_THIN_POOL_AUTOEXTEND_THRESHOLD) * PERCENT_1;
+		policy_amount =
+			find_config_tree_int(cmd, "activation/thin_pool_autoextend_percent",
+					     DEFAULT_THIN_POOL_AUTOEXTEND_PERCENT);
+	} else {
+		policy_threshold =
+			find_config_tree_int(cmd, "activation/snapshot_autoextend_threshold",
+					     DEFAULT_SNAPSHOT_AUTOEXTEND_THRESHOLD) * PERCENT_1;
+		policy_amount =
+			find_config_tree_int(cmd, "activation/snapshot_autoextend_percent",
+					     DEFAULT_SNAPSHOT_AUTOEXTEND_PERCENT);
+	}
 
 	if (policy_threshold >= PERCENT_100)
 		return 1; /* nothing to do */
 
-	if (!lv_snapshot_percent(lv, &percent))
-		return_0;
-
-	if (!(PERCENT_0 < percent && percent < PERCENT_100) || percent <= policy_threshold)
-		return 1; /* nothing to do */
+	if (lv_is_thin_pool(lv)) {
+		if (!lv_thin_pool_percent(lv, &percent))
+			return_0;
+		if (!(PERCENT_0 < percent && percent <= PERCENT_100) ||
+		    percent <= policy_threshold)
+			return 1; /* nothing to do */
+	} else {
+		if (!lv_snapshot_percent(lv, &percent))
+			return_0;
+		if (!(PERCENT_0 < percent && percent < PERCENT_100) || percent <= policy_threshold)
+			return 1; /* nothing to do */
+	}
 
 	lp->extents = policy_amount;
+
 	return 1;
 }
 
@@ -399,8 +416,9 @@
 	lv = lvl->lv;
 
 	if (use_policy) {
-		if (!lv_is_cow(lv)) {
-			log_error("Can't use policy-based resize for non-snapshot volumes.");
+		if (!lv_is_cow(lv) &&
+		    !lv_is_thin_pool(lv)) {
+			log_error("Policy-based resize is supported only for snapshot and thin pool volumes.");
 			return ECMD_FAILED;
 		}
 		_adjust_policy_params(cmd, lv, lp);


^ permalink raw reply	[flat|nested] 2+ messages in thread
* LVM2 doc/example.conf.in lib/config/defaults.h ...
@ 2011-11-04 22:44 zkabelac
  0 siblings, 0 replies; 2+ messages in thread
From: zkabelac @ 2011-11-04 22:44 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2011-11-04 22:44:22

Modified files:
	doc            : example.conf.in 
	lib/config     : defaults.h 
	lib/metadata   : lv_manip.c 

Log message:
	Thin add thin_pool_metadata_require_separate_pvs
	
	Allow to set different policy for pool from mirrors.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/doc/example.conf.in.diff?cvsroot=lvm2&r1=1.34&r2=1.35
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/defaults.h.diff?cvsroot=lvm2&r1=1.86&r2=1.87
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.321&r2=1.322

--- LVM2/doc/example.conf.in	2011/10/11 09:13:39	1.34
+++ LVM2/doc/example.conf.in	2011/11/04 22:44:21	1.35
@@ -213,6 +213,11 @@
 #    until version 2.02.85.
 #
 #    mirror_logs_require_separate_pvs = 0
+#
+#    Set to 1 to guarantee that thin pool metadata will always
+#    be placed on different PVs from the pool data.
+#
+#    thin_pool_metadata_require_separate_pvs = 0
 #}
 
 # This section that allows you to configure the nature of the
--- LVM2/lib/config/defaults.h	2011/11/04 22:43:10	1.86
+++ LVM2/lib/config/defaults.h	2011/11/04 22:44:21	1.87
@@ -60,6 +60,7 @@
 #define DEFAULT_DMEVENTD_MONITOR 1
 #define DEFAULT_BACKGROUND_POLLING 1
 
+#define DEFAULT_THIN_POOL_METADATA_REQUIRE_SEPARATE_PVS 0
 #define DEFAULT_THIN_POOL_MAX_METADATA_SIZE (16 * 1024 * 1024)  /* KB */
 #define DEFAULT_THIN_POOL_MIN_METADATA_SIZE 2048  /* KB */
 
--- LVM2/lib/metadata/lv_manip.c	2011/11/04 22:43:10	1.321
+++ LVM2/lib/metadata/lv_manip.c	2011/11/04 22:44:22	1.322
@@ -788,6 +788,8 @@
 	ah->region_size = region_size;
 	ah->alloc = alloc;
 	ah->area_multiple = _calc_area_multiple(segtype, area_count, stripes);
+	ah->mirror_logs_separate = find_config_tree_bool(cmd, "allocation/mirror_logs_require_separate_pvs",
+							 DEFAULT_MIRROR_LOGS_REQUIRE_SEPARATE_PVS);
 
 	if (segtype_is_raid(segtype)) {
 		if (metadata_area_count) {
@@ -813,6 +815,9 @@
 		/* thin_pool uses region_size to pass metadata size in extents */
 		ah->log_len = ah->region_size;
 		ah->region_size = 0;
+		ah->mirror_logs_separate =
+			find_config_tree_bool(cmd, "allocation/thin_pool_metadata_require_separate_pvs",
+					      DEFAULT_THIN_POOL_METADATA_REQUIRE_SEPARATE_PVS);
 	} else {
 		ah->log_area_count = metadata_area_count;
 		ah->log_len = !metadata_area_count ? 0 :
@@ -829,8 +834,6 @@
 
 	ah->maximise_cling = find_config_tree_bool(cmd, "allocation/maximise_cling", DEFAULT_MAXIMISE_CLING);
 
-	ah->mirror_logs_separate = find_config_tree_bool(cmd, "allocation/mirror_logs_require_separate_pvs", DEFAULT_MIRROR_LOGS_REQUIRE_SEPARATE_PVS);
-
 	return ah;
 }
 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-12-21 13:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-21 13:10 LVM2 doc/example.conf.in lib/config/defaults.h zkabelac
  -- strict thread matches above, loose matches on Subject: below --
2011-11-04 22:44 zkabelac

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).