mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
config: runtime default for allocation/thin_pool_chunk_size
The allocation/thin_pool_chunk_size is a bit more complex. It's default value is evaluated in runtime based on selected thin_pool_chunk_size_policy. But the value is just a starting point. The calculation then continues with dependency on the properties of the devices used. Which means for such a default value, we know only the starting value.
This commit is contained in:
parent
932e75e89f
commit
d27868e94f
@ -1692,3 +1692,22 @@ const char *get_default_activation_mirror_image_fault_policy_CFG(struct cmd_cont
|
||||
{
|
||||
return find_config_tree_str(cmd, activation_mirror_device_fault_policy_CFG, profile);
|
||||
}
|
||||
|
||||
int get_default_allocation_thin_pool_chunk_size_CFG(struct cmd_context *cmd, struct profile *profile)
|
||||
{
|
||||
const char *str;
|
||||
uint32_t chunk_size;
|
||||
|
||||
str = find_config_tree_str(cmd, allocation_thin_pool_chunk_size_policy_CFG, profile);
|
||||
|
||||
if (!strcasecmp(str, "generic"))
|
||||
chunk_size = DEFAULT_THIN_POOL_CHUNK_SIZE;
|
||||
else if (!strcasecmp(str, "performance"))
|
||||
chunk_size = DEFAULT_THIN_POOL_CHUNK_SIZE_PERFORMANCE;
|
||||
else {
|
||||
log_error("Thin pool chunk size calculation policy \"%s\" is unrecognised.", str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (int) chunk_size;
|
||||
}
|
||||
|
@ -236,5 +236,6 @@ const char *get_default_backup_backup_dir_CFG(struct cmd_context *cmd, struct pr
|
||||
const char *get_default_backup_archive_dir_CFG(struct cmd_context *cmd, struct profile *profile);
|
||||
const char *get_default_config_profile_dir_CFG(struct cmd_context *cmd, struct profile *profile);
|
||||
const char *get_default_activation_mirror_image_fault_policy_CFG(struct cmd_context *cmd, struct profile *profile);
|
||||
int get_default_allocation_thin_pool_chunk_size_CFG(struct cmd_context *cmd, struct profile *profile);
|
||||
|
||||
#endif
|
||||
|
@ -125,7 +125,7 @@ cfg(allocation_thin_pool_metadata_require_separate_pvs_CFG, "thin_pool_metadata_
|
||||
cfg(allocation_thin_pool_zero_CFG, "thin_pool_zero", allocation_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, DEFAULT_THIN_POOL_ZERO, vsn(2, 2, 99), NULL)
|
||||
cfg(allocation_thin_pool_discards_CFG, "thin_pool_discards", allocation_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_THIN_POOL_DISCARDS, vsn(2, 2, 99), NULL)
|
||||
cfg(allocation_thin_pool_chunk_size_policy_CFG, "thin_pool_chunk_size_policy", allocation_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_THIN_POOL_CHUNK_SIZE_POLICY, vsn(2, 2, 101), NULL)
|
||||
cfg(allocation_thin_pool_chunk_size_CFG, "thin_pool_chunk_size", allocation_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_INT, 0, vsn(2, 2, 99), NULL)
|
||||
cfg_runtime(allocation_thin_pool_chunk_size_CFG, "thin_pool_chunk_size", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_UNDEFINED, CFG_TYPE_INT, vsn(2, 2, 99), NULL)
|
||||
|
||||
|
||||
cfg(log_verbose_CFG, "verbose", log_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_VERBOSE, vsn(1, 0, 0), NULL)
|
||||
|
@ -5771,10 +5771,7 @@ static int _recalculate_pool_chunk_size_with_dev_hints(struct lvcreate_params *l
|
||||
|
||||
min_chunk_size = DM_THIN_MIN_DATA_BLOCK_SIZE;
|
||||
max_chunk_size = DM_THIN_MAX_DATA_BLOCK_SIZE;
|
||||
if (lp->thin_chunk_size_calc_policy == THIN_CHUNK_SIZE_CALC_METHOD_PERFORMANCE)
|
||||
default_chunk_size = DEFAULT_THIN_POOL_CHUNK_SIZE_PERFORMANCE*2;
|
||||
else
|
||||
default_chunk_size = DEFAULT_THIN_POOL_CHUNK_SIZE*2;
|
||||
default_chunk_size = get_default_allocation_thin_pool_chunk_size_CFG(cmd, NULL) * 2;
|
||||
} else if (seg_is_cache_pool(lp)) {
|
||||
if (find_config_tree_int(cmd, allocation_cache_pool_chunk_size_CFG, NULL))
|
||||
goto out;
|
||||
|
@ -366,26 +366,6 @@ int update_pool_lv(struct logical_volume *lv, int activate)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int _get_pool_chunk_size_calc(const char *str,
|
||||
int *chunk_size_calc_method,
|
||||
uint32_t *chunk_size)
|
||||
{
|
||||
if (!strcasecmp(str, "generic")) {
|
||||
*chunk_size_calc_method = THIN_CHUNK_SIZE_CALC_METHOD_GENERIC;
|
||||
*chunk_size = DEFAULT_THIN_POOL_CHUNK_SIZE * 2;
|
||||
}
|
||||
else if (!strcasecmp(str, "performance")) {
|
||||
*chunk_size_calc_method = THIN_CHUNK_SIZE_CALC_METHOD_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;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
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,
|
||||
@ -396,8 +376,15 @@ int update_profilable_pool_params(struct cmd_context *cmd, struct profile *profi
|
||||
if (!(passed_args & PASS_ARG_CHUNK_SIZE)) {
|
||||
if (!(*chunk_size = find_config_tree_int(cmd, allocation_thin_pool_chunk_size_CFG, profile) * 2)) {
|
||||
str = find_config_tree_str(cmd, allocation_thin_pool_chunk_size_policy_CFG, profile);
|
||||
if (!_get_pool_chunk_size_calc(str, chunk_size_calc_method, chunk_size))
|
||||
return_0;
|
||||
if (!strcasecmp(str, "generic"))
|
||||
*chunk_size_calc_method = THIN_CHUNK_SIZE_CALC_METHOD_GENERIC;
|
||||
else if (!strcasecmp(str, "performance"))
|
||||
*chunk_size_calc_method = THIN_CHUNK_SIZE_CALC_METHOD_PERFORMANCE;
|
||||
else {
|
||||
log_error("Thin pool chunk size calculation policy \"%s\" is unrecognised.", str);
|
||||
return 0;
|
||||
}
|
||||
*chunk_size = get_default_allocation_thin_pool_chunk_size_CFG(cmd, profile) * 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user