From 134641d62d9cd24c200f04134577f9bc2ba0ac3e Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Fri, 4 Nov 2011 22:44:21 +0000 Subject: [PATCH] Thin add thin_pool_metadata_require_separate_pvs Allow to set different policy for pool from mirrors. --- doc/example.conf.in | 5 +++++ lib/config/defaults.h | 1 + lib/metadata/lv_manip.c | 7 +++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/doc/example.conf.in b/doc/example.conf.in index 3c08d1242..ed15db6c9 100644 --- a/doc/example.conf.in +++ b/doc/example.conf.in @@ -213,6 +213,11 @@ devices { # 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 diff --git a/lib/config/defaults.h b/lib/config/defaults.h index 131796237..6819a9a80 100644 --- a/lib/config/defaults.h +++ b/lib/config/defaults.h @@ -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 */ diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index ef71f4fa3..2c2fa0f57 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -788,6 +788,8 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd, 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 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd, /* 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 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd, 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; }