master - thin and cache: unify pool common code
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=894eda4707dbcf9e160922d95621703c0fa58f94 Commit: 894eda4707dbcf9e160922d95621703c0fa58f94 Parent: 8c56c5fbacf6a4e9a0130b6f1fdc5683d6f108ec Author: Zdenek Kabelac <[email protected]> AuthorDate: Tue Jul 22 22:20:18 2014 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Tue Jul 22 22:41:38 2014 +0200
thin and cache: unify pool common code
Fix get_pool_params to only read params. Add poolmetadataspare option to get_pool_params. Move all profile code into update_pool_params. Move recalculate code into pool_manip.c
--- WHATS_NEW | 1 + lib/config/config.c | 6 +- lib/metadata/cache_manip.c | 11 ++-- lib/metadata/lv_manip.c | 104 +++------------------------------- lib/metadata/metadata-exported.h | 24 +++++--- lib/metadata/pool_manip.c | 116 ++++++++++++++++++++++++++++++++++++++ lib/metadata/thin_manip.c | 63 +++++++-------------- tools/lvconvert.c | 84 ++++++++------------------- tools/lvcreate.c | 57 +++++------------- tools/toollib.c | 69 +++++++++++++---------- tools/toollib.h | 6 +- 11 files changed, 253 insertions(+), 288 deletions(-)
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.02.108 - ================================= + Improve code sharing for lvconvert and lvcreate and pools (cache & thin). Improve lvconvert --merge validation. Improve lvconvert --splitsnapshot validation. Add report/list_item_separator lvm.conf option.
lib/config/config.c +3 -3
@@ -1988,9 +1988,9 @@ int get_default_allocation_thin_pool_chunk_size_CFG(struct cmd_context *cmd, str }if (!strcasecmp (str,"generic" )) - chunk_size =DEFAULT_THIN_POOL_CHUNK_SIZE ; + chunk_size =DEFAULT_THIN_POOL_CHUNK_SIZE *2 ;else if (!strcasecmp (str,"performance" )) - chunk_size =DEFAULT_THIN_POOL_CHUNK_SIZE_PERFORMANCE ; + chunk_size =DEFAULT_THIN_POOL_CHUNK_SIZE_PERFORMANCE *2 ;else {log_error ("Thin pool chunk size calculation policy \"%s\" is unrecognised." , str);return 0 ;
@@ -2001,5 +2001,5 @@ int get_default_allocation_thin_pool_chunk_size_CFG(struct cmd_context *cmd, strint get_default_allocation_cache_pool_chunk_size_CFG (struct cmd_context *cmd,struct profile *profile) { -return DEFAULT_CACHE_POOL_CHUNK_SIZE ; +return DEFAULT_CACHE_POOL_CHUNK_SIZE *2 ; }
lib/metadata/cache_manip.c +6 -5
@@ -23,14 +23,15 @@#include "defaults.h" 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) +int passed_args,uint32_t data_extents, +uint64_t *pool_metadata_size, +int *chunk_size_calc_method,uint32_t *chunk_size) {uint64_t min_meta_size; +if (!(passed_args &PASS_ARG_CHUNK_SIZE )) + *chunk_size =DEFAULT_CACHE_POOL_CHUNK_SIZE *2 ; +if ((*chunk_size <DM_CACHE_MIN_DATA_BLOCK_SIZE ) || (*chunk_size >DM_CACHE_MAX_DATA_BLOCK_SIZE )) { log_error("Chunk size must be in the range %s to %s.",
lib/metadata/lv_manip.c +9 -95
122 lines not on this page · raw message
lib/metadata/metadata-exported.h +15 -9
@@ -703,17 +703,25 @@ struct logical_volume *find_pool_lv(const struct logical_volume *lv);int pool_is_active (const struct logical_volume *pool_lv);int pool_supports_external_origin (const struct lv_segment *pool_seg,const struct logical_volume *external_lv);int thin_pool_feature_supported (const struct logical_volume *pool_lv,int feature); +int recalculate_pool_chunk_size_with_dev_hints (struct logical_volume *pool_lv, +int passed_args, +int chunk_size_calc_policy);int update_pool_lv (struct logical_volume *lv,int activate); +int update_pool_params (const struct segment_type *segtype, +struct volume_group *vg,unsigned target_attr, +int passed_args,uint32_t data_extents, +uint64_t *pool_metadata_size, +int *chunk_size_calc_policy,uint32_t *chunk_size, +thin_discards_t *discards,int *zero);int update_profilable_pool_params (struct cmd_context *cmd,struct profile *profile,int passed_args,int *chunk_size_calc_method,uint32_t *chunk_size,thin_discards_t *discards,int *zero);int update_thin_pool_params (struct volume_group *vg,unsigned attr, -int passed_args, -uint32_t data_extents,uint32_t extent_size, +int passed_args,uint32_t data_extents, +uint64_t *pool_metadata_size,int *chunk_size_calc_method,uint32_t *chunk_size, -thin_discards_t *discards, -uint64_t *pool_metadata_size,int *zero); +thin_discards_t *discards,int *zero);int get_pool_discards (const char *str,thin_discards_t *discards);const char *get_pool_discards_name (thin_discards_t discards); struct logical_volume *alloc_pool_metadata(struct logical_volume *pool_lv,
@@ -1043,11 +1051,9 @@ int partial_raid_lv_supports_degraded_activation(struct logical_volume *lv);/* ++ 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); +int passed_args,uint32_t data_extents, +uint64_t *pool_metadata_size, +int *chunk_size_calc_method,uint32_t *chunk_size);struct logical_volume *lv_cache_create (struct logical_volume *pool,struct logical_volume *origin);int lv_cache_remove (struct logical_volume *cache_lv);
lib/metadata/pool_manip.c +116 -0
129 lines not on this page · raw message
lib/metadata/thin_manip.c +20 -43
112 lines not on this page · raw message
tools/lvconvert.c +25 -59
122 lines not on this page · raw message
tools/lvcreate.c +16 -41
106 lines not on this page · raw message
tools/toollib.c +39 -30
98 lines not on this page · raw message
tools/toollib.h +3 -3
@@ -125,12 +125,12 @@ int get_activation_monitoring_mode(struct cmd_context *cmd, int *monitoring_mode);int get_pool_params (struct cmd_context *cmd, -struct profile *profile, +const struct segment_type *segtype,int *passed_args, -int *chunk_size_calc_method, +uint64_t *pool_metadata_size, +int *pool_metadataspare,uint32_t *chunk_size,thin_discards_t *discards, -uint64_t *pool_metadata_size,int *zero); int get_stripe_params(struct cmd_context *cmd, uint32_t *stripes,