master - cache: add cache_policy cache_settings
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=036d90bba6c1ac76195302bc5c7f2f5ce8ad89b4 Commit: 036d90bba6c1ac76195302bc5c7f2f5ce8ad89b4 Parent: 664a9f4830925cc3f51934dc09f9e2f3963c0de2 Author: Zdenek Kabelac <[email protected]> AuthorDate: Mon Jul 20 11:44:15 2015 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Wed Aug 12 14:11:16 2015 +0200
cache: add cache_policy cache_settings
Add new profilable configurables:
allocation/cache_policy
allocation/cache_settings
and mark allocation/cache_pool_chunk_size as profilable as well.
Obsolete allocation/cache_pool_cachemode and
introduce new allocation/cache_mode instead.
Rename DEFAULT_CACHE_POOL_POLICY to DEFAULT_CACHE_POLICY.
--- WHATS_NEW | 1 + lib/cache_segtype/cache.c | 2 +- lib/config/config.c | 5 +++++ lib/config/config.h | 2 ++ lib/config/config_settings.h | 24 +++++++++++++++++++++--- lib/config/defaults.h | 4 ++-- tools/toollib.c | 2 +- 7 files changed, 33 insertions(+), 7 deletions(-)
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.02.128 - =================================== + Add cmd profilable allocation/cache_policy,cache_settings,cache_mode. Require cache_check 0.5.4 for use of --clear-needs-check-flag. Fix lvmetad udev rules to not override SYSTEMD_WANTS, add the service instead.
lib/cache_segtype/cache.c +1 -1
@@ -79,7 +79,7 @@ static int _cache_pool_text_import(struct lv_segment *seg,return SEG_LOG_ERROR ("Failed to duplicate policy in" ); }else {/* Cannot use 'just' default, so pick one */ - seg->policy_name =DEFAULT_CACHE_POOL_POLICY ;/* FIXME make configurable */ + seg->policy_name =DEFAULT_CACHE_POLICY ;/* FIXME make configurable */ /* FIXME maybe here should be always 'mq' */ log_warn ("WARNING: cache_policy undefined, using default \"%s\" policy." , seg->policy_name);
lib/config/config.c +5 -0
@@ -2415,3 +2415,8 @@ int get_default_allocation_cache_pool_chunk_size_CFG(struct cmd_context *cmd, st {return DEFAULT_CACHE_POOL_CHUNK_SIZE *2 ; } + +const char *get_default_allocation_cache_policy_CFG (struct cmd_context *cmd,struct profile *profile) +{ +return DEFAULT_CACHE_POLICY ; +}
lib/config/config.h +2 -0
@@ -296,5 +296,7 @@ int get_default_allocation_thin_pool_chunk_size_CFG(struct cmd_context *cmd, str#define get_default_unconfigured_allocation_thin_pool_chunk_size_CFG NULLint get_default_allocation_cache_pool_chunk_size_CFG (struct cmd_context *cmd,struct profile *profile);#define get_default_unconfigured_allocation_cache_pool_chunk_size_CFG NULL +const char *get_default_allocation_cache_policy_CFG (struct cmd_context *cmd,struct profile *profile); +#define get_default_unconfigured_allocation_cache_policy_CFG NULL#endif
lib/config/config_settings.h +21 -3
@@ -462,15 +462,33 @@ cfg(allocation_mirror_logs_require_separate_pvs_CFG, "mirror_logs_require_separacfg (allocation_cache_pool_metadata_require_separate_pvs_CFG,"cache_pool_metadata_require_separate_pvs" , allocation_CFG_SECTION,0 ,CFG_TYPE_BOOL ,DEFAULT_CACHE_POOL_METADATA_REQUIRE_SEPARATE_PVS ,vsn (2 ,2 ,106 ),NULL ,0 ,NULL , "Cache pool metadata and data will always use different PVs.\n") -cfg (allocation_cache_pool_cachemode_CFG,"cache_pool_cachemode" , allocation_CFG_SECTION,CFG_DEFAULT_COMMENTED ,CFG_TYPE_STRING ,DEFAULT_CACHE_POOL_CACHEMODE ,vsn (2 ,2 ,113 ),NULL ,0 ,NULL , -"The default cache mode used for new cache pools.\n" +cfg (allocation_cache_pool_cachemode_CFG,"cache_pool_cachemode" , allocation_CFG_SECTION,CFG_DEFAULT_COMMENTED ,CFG_TYPE_STRING ,DEFAULT_CACHE_MODE ,vsn (2 ,2 ,113 ),NULL ,vsn (2 ,2 ,128 ), +"This has been replaced by the allocation/cache_mode setting.\n" , + "Cache mode.\n") + +cfg (allocation_cache_mode_CFG,"cache_mode" , allocation_CFG_SECTION,CFG_DEFAULT_COMMENTED ,CFG_TYPE_STRING ,DEFAULT_CACHE_MODE ,vsn (2 ,2 ,128 ),NULL ,0 ,NULL , +"The default cache mode used for new cache.\n" "Possible options are: writethrough, writeback.\n" "writethrough - Data blocks are immediately written from\n" "the cache to disk.\n" "writeback - Data blocks are written from the cache back\n" "to disk after some delay to improve performance.\n") -cfg_runtime (allocation_cache_pool_chunk_size_CFG,"cache_pool_chunk_size" , allocation_CFG_SECTION,CFG_DEFAULT_UNDEFINED ,CFG_TYPE_INT ,vsn (2 ,2 ,106 ),0 ,NULL , +cfg_runtime (allocation_cache_policy_CFG,"cache_policy" , allocation_CFG_SECTION,CFG_PROFILABLE |CFG_DEFAULT_COMMENTED ,CFG_TYPE_STRING ,vsn (2 ,2 ,127 ),0 ,NULL , +"The default cache policy used for new cache volume.\n" +"Generally available policies are: mq, smq.\n" +"mq - Multiqueue policy with 88 bytes per block\n" + "smq - Stochastic multique with 25 bytes per block (kernel >= 4.2).\n") + +cfg_section (allocation_cache_settings_CFG_SECTION,"cache_settings" , allocation_CFG_SECTION,CFG_PROFILABLE |CFG_DEFAULT_COMMENTED ,vsn (2 ,2 ,127 ),0 ,NULL , +"Individual settings for policies.\n" + "See the help for individual policies for more info.\n") + +cfg_section (policy_settings_CFG_SUBSECTION,"policy_settings" , allocation_cache_settings_CFG_SECTION,CFG_NAME_VARIABLE |CFG_SECTION_NO_CHECK |CFG_PROFILABLE |CFG_DEFAULT_COMMENTED ,vsn (2 ,2 ,127 ),0 ,NULL , +"Replace this subsection name with a policy name.\n" + "Multiple subsections for different policies can be created.\n") + +cfg_runtime (allocation_cache_pool_chunk_size_CFG,"cache_pool_chunk_size" , allocation_CFG_SECTION,CFG_PROFILABLE |CFG_DEFAULT_UNDEFINED ,CFG_TYPE_INT ,vsn (2 ,2 ,106 ),0 ,NULL ,"The minimal chunk size (in kiB) for cache pool volumes.\n" "Using a chunk_size that is too large can result in wasteful\n" "use of the cache, where small reads and writes can cause\n"
lib/config/defaults.h +2 -2
@@ -117,8 +117,8 @@#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_CACHE_POOL_CACHEMODE "writethrough" -#define DEFAULT_CACHE_POOL_POLICY "mq" +#define DEFAULT_CACHE_POLICY "mq" +#define DEFAULT_CACHE_MODE "writethrough"#define DEFAULT_UMASK 0077
tools/toollib.c +1 -1
@@ -1408,7 +1408,7 @@ int get_cache_policy_params(struct cmd_context *cmd, const char **name,struct dm_config_node *cn;int ok =0 ; - *name =arg_str_value (cmd, cachepolicy_ARG,DEFAULT_CACHE_POOL_POLICY ); + *name =arg_str_value (cmd, cachepolicy_ARG,DEFAULT_CACHE_POLICY ); dm_list_iterate_items(group, &cmd->arg_value_groups) {if (!grouped_arg_is_set (group->arg_values, cachesettings_ARG))