main - vdo: support --vdosettings
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=5e060b8fa71dcf7ad2ff2daca8dbfa009f691852 Commit: 5e060b8fa71dcf7ad2ff2daca8dbfa009f691852 Parent: dd28460017356d9a1a30a787b5572e9bcbf1c4a4 Author: Zdenek Kabelac <[email protected]> AuthorDate: Wed Apr 13 15:09:08 2022 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Tue May 3 19:09:52 2022 +0200
vdo: support --vdosettings
Allow to use --vdosettings with lvcreate,lvconvert,lvchange. Support settings currenly only configurable via lvm.conf. With lvchange we require inactivate LV for changes to be applied.
Settings block_map_era_length has supported alias block_map_period.
--- WHATS_NEW | 1 + device_mapper/vdo/target.h | 6 +- man/lvmvdo.7_main | 39 ++++++++-- test/shell/lvchange-vdo.sh | 8 ++ test/shell/lvconvert-vdo.sh | 8 +- test/shell/lvcreate-vdo.sh | 6 +- tools/args.h | 9 +++ tools/command-lines.in | 6 +- tools/lvchange.c | 43 ++++++++++- tools/lvconvert.c | 9 +-- tools/lvcreate.c | 34 +++++---- tools/toollib.c | 177 ++++++++++++++++++++++++++++++++++++++++++++ tools/toollib.h | 6 ++ 13 files changed, 313 insertions(+), 39 deletions(-)
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.03.16 - ==================================== + Add support --vdosettings with lvcreate, lvconvert, lvchange. Fix lossing of delete message on thin-pool extension. Version 2.03.15 - 07th February 2022
device_mapper/vdo/target.h +4 -2
@@ -77,8 +77,10 @@ enum dm_vdo_write_policy {struct dm_vdo_target_params {uint32_t minimum_io_size;// in sectors uint32_t block_map_cache_size_mb; -uint32_t block_map_era_length;// format period - +union { +uint32_t block_map_era_length;// format period +uint32_t block_map_period;// supported alias + };uint32_t check_point_frequency;uint32_t index_memory_size_mb;// format
man/lvmvdo.7_main +31 -8
@@ -132,6 +132,19 @@ that can keep 100% incompressible data there. # lvconvert --type vdo-pool -n vdo0 -V10G vg/ExistingLV .fi . +.SS \n+[step]. Change the compression and deduplication of a VDOPoolLV +. +Disable or enable the compression and deduplication for VDOPoolLV +(the volume that maintains all VDO LV(s) associated with it). +.P +.B lvchange --compression y|n --deduplication y|n VG/VDOPoolLV +.P +.I Example +.nf +# lvchange --compression n vg/vdopool0 +# lvchange --deduplication y vg/vdopool1 +.fi +. .SS \n+[step]. Change the default settings used for creating a VDOPoolLV . VDO allows to set a large variety of options. Lots of these settings
@@ -173,17 +186,27 @@ EOF # lvcreate --vdo -L10G --config 'allocation/vdo_cpu_threads=4' vg/vdopool1 .fi . -.SS \n+[step]. Change the compression and deduplication of a VDOPoolLV -. -Disable or enable the compression and deduplication for VDOPoolLV -(the volume that maintains all VDO LV(s) associated with it). -.P -.B lvchange --compression y|n --deduplication y|n VG/VDOPoolLV +.SS \n+[step]. Set or change VDO settings with option --vdosettings +. +Use the form 'option=value' or 'option1=value option2=value', +or repeat --vdosettings for each option being set. +Options are listed in the Example section above, for the full description see +.BR lvm.conf (5). +Options can omit 'vdo_' and 'vdo_use_' prefixes and all its underscores. +So i.e. vdo_use_metadata_hints=1 and metadatahints=1 are equivalent. +To change the option for an already existing VDOPoolLV use +.BR lvchange (8) +command. However not all option can be changed. +Only compression and deduplication options can be also changed for an active VDO LV. +Lowest priority options are specified with configuration file, +then with --vdosettings and highest are expliction option --compression +and --deduplication. .P .I Example +.P .nf -# lvchange --compression n vg/vdopool0 -# lvchange --deduplication y vg/vdopool1 +# lvcreate --vdo -L10G --vdosettings 'ack_threads=1 hash_zone_threads=2' vg/vdopool0 +# lvchange --vdosettings 'bio_threads=2 deduplication=1' vg/vdopool0 .fi . .SS \n+[step]. Checking the usage of VDOPoolLV
test/shell/lvchange-vdo.sh +8 -0
@@ -48,9 +48,17 @@ check grep_dmsetup status $vg-vdopool-vpool " online online " lvchange --compression n --deduplication n $vg/vdopool check grep_dmsetup status $vg-vdopool-vpool " offline offline " +# --vdosettings needs inactive LV +not lvchange --vdosettings 'ack_threads=8' $vg/vdopool lvchange -an $vg/$lv1 +# With inactive vdo-pool changes are applied +# explicit option --compression has highest priority +lvchange --vdosettings 'ack_threads=5 compression=0' --compression y $vg/vdopool +check lv_field $vg/$lv1 vdo_ack_threads "5" +check lv_field $vg/$lv1 vdo_compression "enabled" + # Test activation lvchange -aly $vg/$lv1 check active $vg $lv1
test/shell/lvconvert-vdo.sh +4 -4
@@ -28,12 +28,12 @@ lvcreate -L5G -n $lv1 $vg not lvconvert --type vdo-pool $vg/$lv1 |& tee out grep "WARNING" out - -lvconvert -y --type vdo-pool $vg/$lv1 +# Check --vdosettings is also applied to converted vdo-pool +lvconvert -y --type vdo-pool --vdosettings 'ack_threads=5' $vg/$lv1 +check lv_field $vg/$lv1 vdo_ack_threads "5" lvremove -f $vg - -# +# lvcreate -L5G -n $lv1 $vg lvconvert -y --vdopool $vg/$lv1 lvremove -f $vg
test/shell/lvcreate-vdo.sh +5 -1
@@ -79,8 +79,12 @@ not fsck -n "$DM_DEV_DIR/mapper/$vg-${lv2}" lvremove -ff $vg +# Unknown settings does not pass +# TODO: try to catch this in parser and 'fail' +not lvcreate --type vdo --vdosettings 'ack_Xthreads=4' -L10G -V1T -ky -n $lv1 $vg -lvcreate --type vdo -L10G -V1T -ky -n $lv1 $vg +lvcreate --type vdo --vdosettings 'ack_threads=4' -L10G -V1T -ky -n $lv1 $vg +check lv_field $vg/$lv1 vdo_ack_threads "4" lvs -a $vg lvremove -ff $vg
tools/args.h +9 -0
@@ -912,6 +912,15 @@ arg(vdopool_ARG, '\0', "vdopool", lv_VAL, 0, 0, "The name of a VDO pool LV.\n" "See \\fBlvmvdo\\fP(7) for more information about VDO usage.\n") +arg (vdosettings_ARG,'\0' ,"vdosettings" , string_VAL,ARG_GROUPABLE ,0 , +"Specifies tunable VDO options for VDO LVs.\n" +"Use the form 'option=value' or 'option1=value option2=value', or\n" +"repeat --vdosettings for each option being set.\n" +"These settings override the default VDO behaviors.\n" +"To remove vdosettings and revert to the default\n" +"VDO behaviors, use --vdosettings 'default'.\n" + "See \\fBlvmvdo\\fP(7) for more information.\n") +arg (version_ARG,'\0' ,"version" ,0 ,0 ,0 ,"Display version information.\n" )
tools/command-lines.in +4 -2
@@ -243,6 +243,7 @@ OO_LVCHANGE_META: --addtag Tag, --deltag Tag, --setautoactivation Bool, --errorwhenfull Bool, --discards Discards, --zero Bool, --cachemode CacheMode, --cachepolicy String, --cachesettings String, --minrecoveryrate SizeKB, --maxrecoveryrate SizeKB, +--vdosettings String, --writebehind Number, --writemostly WriteMostlyPV, --persistent n # It's unfortunate that activate needs to be optionally allowed here;
@@ -341,7 +342,8 @@ OO_LVCONVERT_CACHE: --cachemetadataformat CacheMetadataFormat, --cachesettings String, --zero Bool OO_LVCONVERT_VDO: --metadataprofile String, --readahead Readahead, ---compression Bool, --deduplication Bool, --zero Bool +--compression Bool, --deduplication Bool, --vdosettings String, +--zero Bool OO_LVCONVERT: --alloc Alloc, --background, --force, --noudevsync
@@ -839,7 +841,7 @@ OO_LVCREATE_POOL: --poolmetadatasize SizeMB, --poolmetadataspare Bool, --chunksi OO_LVCREATE_THINPOOL: --discards Discards, --errorwhenfull Bool -OO_LVCREATE_VDO: --compression Bool, --deduplication Bool +OO_LVCREATE_VDO: --compression Bool, --deduplication Bool, --vdosettings String --- lvcreate --type error --size SizeMB VG
tools/lvchange.c +42 -1
61 lines not on this page · raw message
tools/lvconvert.c +2 -7
@@ -5454,13 +5454,8 @@ static int _lvconvert_to_vdopool_single(struct cmd_context *cmd,if (!fill_vdo_target_params (cmd, &vdo_params, &vdo_pool_header_size, vg->profile)) goto_out; -if (arg_is_set (cmd, compression_ARG)) - vdo_params.use_compression = -arg_int_value (cmd, compression_ARG,0 ); - -if (arg_is_set (cmd, deduplication_ARG)) - vdo_params.use_deduplication = -arg_int_value (cmd, deduplication_ARG,0 ); +if (!get_vdo_settings (cmd, &vdo_params,NULL )) + return_0;if (!activate_lv (cmd, lv)) {log_error ("Cannot activate %s." ,display_lvname (lv));
tools/lvcreate.c +20 -14
@@ -698,6 +698,23 @@ static int _read_cache_params(struct cmd_context *cmd,return 1 ; } +static int _read_vdo_params (struct cmd_context *cmd, +struct lvcreate_params *lp) +{ +if (!seg_is_vdo (lp)) +return 1 ; + +// prefiling settings here +if (!fill_vdo_target_params (cmd, &lp->vdo_params, &lp->vdo_pool_header_size,NULL )) + return_0; + +// override with optional vdo settings +if (!get_vdo_settings (cmd, &lp->vdo_params,NULL )) + return_0; + +return 1 ; +} +static int _read_activation_params (struct cmd_context *cmd,struct volume_group *vg,struct lvcreate_params *lp)
@@ -888,7 +905,8 @@ static int _lvcreate_params(struct cmd_context *cmd,#define VDO_POOL_ARGS \ vdopool_ARG,\ compression_ARG,\ - deduplication_ARG + deduplication_ARG,\ + vdosettings_ARG/* Cache and cache-pool segment type */ if (seg_is_cache (lp)) {
@@ -1098,19 +1116,6 @@ static int _lvcreate_params(struct cmd_context *cmd, zero_ARG, -1)) return_0; - -// FIXME: prefiling here - this is wrong place -// but will work for this moment -if (!fill_vdo_target_params (cmd, &lp->vdo_params, &lp->vdo_pool_header_size,NULL )) - return_0; - -if (arg_is_set (cmd, compression_ARG)) - lp->vdo_params.use_compression = -arg_int_value (cmd, compression_ARG,0 ); - -if (arg_is_set (cmd, deduplication_ARG)) - lp->vdo_params.use_deduplication = -arg_int_value (cmd, deduplication_ARG,0 ); }/* Check options shared between more segment types */
@@ -1198,6 +1203,7 @@ static int _lvcreate_params(struct cmd_context *cmd, &lp->pool_metadata_size, &lp->pool_metadata_spare, &lp->chunk_size, &lp->discards, &lp->zero_new_blocks)) || !_read_cache_params(cmd, lp) || + !_read_vdo_params(cmd, lp) || !_read_mirror_and_raid_params(cmd, lp)) return_0;
tools/toollib.c +177 -0
183 lines not on this page · raw message
tools/toollib.h +6 -0
@@ -217,6 +217,12 @@ int get_cache_params(struct cmd_context *cmd,const char **name, struct dm_config_tree **settings); +#define VDO_CHANGE_ONLINE 1 +#define VDO_CHANGE_OFFLINE 2 +int get_vdo_settings (struct cmd_context *cmd, +struct dm_vdo_target_params *vtp, +int *updated); +int get_writecache_settings (struct cmd_context *cmd,struct writecache_settings *settings,uint32_t *block_size_sectors);