Skip to contentSkip to conversation

master - cache pool: Add 'update_cache_pool_params'

PATCH Jonathan Brassow 1 participant 1 message Feb 4, 2014

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=013cf27bff2d46f273505d6ee437085ad9cab5f2
Commit:        013cf27bff2d46f273505d6ee437085ad9cab5f2
Parent:        8ddc7f641ced0a32801d978cd4e8a70883c4897a
Author:        Jonathan Brassow <[email protected]>
AuthorDate:    Tue Feb 4 11:50:27 2014 -0600
Committer:     Jonathan Brassow <[email protected]>
CommitterDate: Tue Feb 4 11:50:27 2014 -0600

cache pool: Add 'update_cache_pool_params'

Similar function to 'update_thin_pool_params', but for cache. Performs the adjustements for chunk_size, metdata device size, etc.

---
 lib/config/defaults.h            |    2 +
 lib/metadata/cache_manip.c       |   52 ++++++++++++++++++++++++++++++++++++++
 lib/metadata/metadata-exported.h |    6 ++++
 tools/lvcreate.c                 |    9 ++++++
 4 files changed, 69 insertions(+), 0 deletions(-)
lib/config/defaults.h +2 -0
index 4f53b3f..437cec7 100644
@@ -81,6 +81,8 @@
 
 #define DEFAULT_CACHE_POOL_METADATA_REQUIRE_SEPARATE_PVS 0
 #define DEFAULT_CACHE_POOL_CHUNK_SIZE 64 /* KB */
+#define DEFAULT_CACHE_POOL_MIN_METADATA_SIZE 2048  /* KB */
+#define DEFAULT_CACHE_POOL_MAX_METADATA_SIZE (16 * 1024 * 1024)  /* KB */
 
 #define DEFAULT_UMASK 0077
 
lib/metadata/cache_manip.c +52 -0

58 lines not on this page · raw message

lib/metadata/metadata-exported.h +6 -0
index 8258b24..b37d91a 100644
@@ -1020,6 +1020,12 @@ int lv_raid_remove_missing(struct logical_volume *lv);
 /* --  metadata/raid_manip.c */
 
 /* ++  metadata/cache_manip.c */
+int update_cache_pool_params(struct volume_group *vg, unsigned attr,
+			     int passed_args,
+			     uint32_t data_extents, uint32_t extent_size,
+			     int *chunk_size_calc_method, uint32_t *chunk_size,
+			     thin_discards_t *discards,
+			     uint64_t *pool_metadata_size, int *zero);
 struct logical_volume *lv_cache_create(struct logical_volume *pool,
 				       struct logical_volume *origin);
 int lv_cache_remove(struct logical_volume *cache_lv);
tools/lvcreate.c +9 -0
index ba7df2a..137c0a2 100644
@@ -230,6 +230,15 @@ static int _determine_snapshot_type(struct volume_group *vg,
 static int _lvcreate_update_pool_params(struct volume_group *vg,
 					struct lvcreate_params *lp)
 {
+	if (seg_is_cache_pool(lp))
+		return update_cache_pool_params(vg, lp->target_attr,
+						lp->passed_args,
+						lp->extents, vg->extent_size,
+						&lp->thin_chunk_size_calc_policy,
+						&lp->chunk_size, &lp->discards,
+						&lp->poolmetadatasize,
+						&lp->zero);
+
 	return update_thin_pool_params(vg, lp->target_attr, lp->passed_args,
 				       lp->extents, vg->extent_size,
 				       &lp->thin_chunk_size_calc_policy,