mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-26 22:50:36 +03:00
conf: add allocation/physical_extent_size config option for default PE size of VGs.
Removes a need to use "vgcreate -s <desired PE size>" all the time time just to override hardcoded default which is 4096KiB.
This commit is contained in:
parent
80ac8f37d6
commit
f0cafc9281
@ -1,5 +1,6 @@
|
||||
Version 2.02.112 -
|
||||
=====================================
|
||||
Add allocation/physical_extent_size config option for default PE size of VGs.
|
||||
Introduce common code to modify metadate and reload updated LV.
|
||||
Fix rename of active snapshot volume in cluster.
|
||||
Make sure shared libraries are built with RELRO option.
|
||||
|
@ -370,6 +370,9 @@ allocation {
|
||||
# first use.
|
||||
# N.B. zeroing larger thin pool chunk size degrades performance.
|
||||
# thin_pool_zero = 1
|
||||
|
||||
# Default physical extent size to use for newly created VGs (in KB).
|
||||
# physical_extent_size = 4096
|
||||
}
|
||||
|
||||
# This section that allows you to configure the nature of the
|
||||
|
@ -126,7 +126,7 @@ cfg(allocation_thin_pool_zero_CFG, "thin_pool_zero", allocation_CFG_SECTION, CFG
|
||||
cfg(allocation_thin_pool_discards_CFG, "thin_pool_discards", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_PROFILABLE_METADATA, 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_PROFILABLE_METADATA, CFG_TYPE_STRING, DEFAULT_THIN_POOL_CHUNK_SIZE_POLICY, vsn(2, 2, 101), NULL)
|
||||
cfg_runtime(allocation_thin_pool_chunk_size_CFG, "thin_pool_chunk_size", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_PROFILABLE_METADATA | CFG_DEFAULT_UNDEFINED, CFG_TYPE_INT, vsn(2, 2, 99), NULL)
|
||||
|
||||
cfg(allocation_physical_extent_size_CFG, "physical_extent_size", allocation_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_EXTENT_SIZE, vsn(2, 2, 112), NULL)
|
||||
|
||||
cfg(log_verbose_CFG, "verbose", log_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_VERBOSE, vsn(1, 0, 0), NULL)
|
||||
cfg(log_silent_CFG, "silent", log_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_SILENT, vsn(2, 2, 98), NULL)
|
||||
|
@ -1305,9 +1305,14 @@ struct dm_list *clone_pv_list(struct dm_pool *mem, struct dm_list *pvsl)
|
||||
return r;
|
||||
}
|
||||
|
||||
void vgcreate_params_set_defaults(struct vgcreate_params *vp_def,
|
||||
struct volume_group *vg)
|
||||
const char _pe_size_may_not_be_negative_msg[] = "Physical extent size may not be negative";
|
||||
|
||||
int vgcreate_params_set_defaults(struct cmd_context *cmd,
|
||||
struct vgcreate_params *vp_def,
|
||||
struct volume_group *vg)
|
||||
{
|
||||
int64_t extent_size;
|
||||
|
||||
if (vg) {
|
||||
vp_def->vg_name = NULL;
|
||||
vp_def->extent_size = vg->extent_size;
|
||||
@ -1318,13 +1323,21 @@ void vgcreate_params_set_defaults(struct vgcreate_params *vp_def,
|
||||
vp_def->vgmetadatacopies = vg->mda_copies;
|
||||
} else {
|
||||
vp_def->vg_name = NULL;
|
||||
vp_def->extent_size = DEFAULT_EXTENT_SIZE * 2;
|
||||
extent_size = find_config_tree_int64(cmd,
|
||||
allocation_physical_extent_size_CFG, NULL) * 2;
|
||||
if (extent_size < 0) {
|
||||
log_error(_pe_size_may_not_be_negative_msg);
|
||||
return 0;
|
||||
}
|
||||
vp_def->extent_size = (uint32_t) extent_size;
|
||||
vp_def->max_pv = DEFAULT_MAX_PV;
|
||||
vp_def->max_lv = DEFAULT_MAX_LV;
|
||||
vp_def->alloc = DEFAULT_ALLOC_POLICY;
|
||||
vp_def->clustered = DEFAULT_CLUSTERED;
|
||||
vp_def->vgmetadatacopies = DEFAULT_VGMETADATACOPIES;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1357,7 +1370,7 @@ int vgcreate_params_set_from_args(struct cmd_context *cmd,
|
||||
vp_new->clustered = locking_is_clustered();
|
||||
|
||||
if (arg_sign_value(cmd, physicalextentsize_ARG, SIGN_NONE) == SIGN_MINUS) {
|
||||
log_error("Physical extent size may not be negative");
|
||||
log_error(_pe_size_may_not_be_negative_msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,8 @@ struct dm_list *create_pv_list(struct dm_pool *mem, struct volume_group *vg, int
|
||||
|
||||
struct dm_list *clone_pv_list(struct dm_pool *mem, struct dm_list *pvs);
|
||||
|
||||
void vgcreate_params_set_defaults(struct vgcreate_params *vp_def,
|
||||
int vgcreate_params_set_defaults(struct cmd_context *cmd,
|
||||
struct vgcreate_params *vp_def,
|
||||
struct volume_group *vg);
|
||||
int vgcreate_params_set_from_args(struct cmd_context *cmd,
|
||||
struct vgcreate_params *vp_new,
|
||||
|
@ -41,7 +41,8 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)
|
||||
return EINVALID_CMD_LINE;
|
||||
}
|
||||
|
||||
vgcreate_params_set_defaults(&vp_def, NULL);
|
||||
if (!vgcreate_params_set_defaults(cmd, &vp_def, NULL))
|
||||
return EINVALID_CMD_LINE;
|
||||
vp_def.vg_name = vg_name;
|
||||
if (!vgcreate_params_set_from_args(cmd, &vp_new, &vp_def))
|
||||
return EINVALID_CMD_LINE;
|
||||
|
@ -551,7 +551,10 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv)
|
||||
if (!vgs_are_compatible(cmd, vg_from,vg_to))
|
||||
goto_bad;
|
||||
} else {
|
||||
vgcreate_params_set_defaults(&vp_def, vg_from);
|
||||
if (!vgcreate_params_set_defaults(cmd, &vp_def, vg_from)) {
|
||||
r = EINVALID_CMD_LINE;
|
||||
goto_bad;
|
||||
}
|
||||
vp_def.vg_name = vg_name_to;
|
||||
if (!vgcreate_params_set_from_args(cmd, &vp_new, &vp_def)) {
|
||||
r = EINVALID_CMD_LINE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user