main - vdo: add support for auto-unsafe writePolicy
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=79427151dc5ffb5faff133c57e058acbad00dd10 Commit: 79427151dc5ffb5faff133c57e058acbad00dd10 Parent: 337053c56a2d288337449067510301d5a2e4eec5 Author: Zdenek Kabelac <[email protected]> AuthorDate: Mon Sep 6 13:56:40 2021 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Mon Sep 6 15:19:51 2021 +0200
vdo: add support for auto-unsafe writePolicy
This vdoWritePolicy policy missed matching support in lvm2.
--- WHATS_NEW | 1 + conf/example.conf.in | 2 ++ device_mapper/libdm-deptree.c | 3 ++- device_mapper/vdo/target.h | 3 ++- device_mapper/vdo/vdo_target.c | 1 + lib/config/config_settings.h | 4 +++- lib/metadata/vdo_manip.c | 4 ++++ 7 files changed, 15 insertions(+), 3 deletions(-)
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.03.14 - ================================== + Add support for VDO async-unsage write policy. Improve lvm_import_vdo script. Support VDO LV with lvcreate -ky. Fix lvconvert for VDO LV bigger then 2T.
conf/example.conf.in +2 -0
@@ -713,6 +713,8 @@ allocation { # This policy is not supported if the underlying storage is not also synchronous. # async - Writes are acknowledged after data has been cached for writing to stable storage. # Data which has not been flushed is not guaranteed to persist in this mode. + # async-unsafe - Writes are handled like 'async' but there is no guarantee of the atomicity async provides. + # This mode should only be used for better performance when atomicity is not required. # This configuration option has an automatic default value. # vdo_write_policy = "auto"
device_mapper/libdm-deptree.c +2 -1
@@ -2885,7 +2885,8 @@ static int _vdo_emit_segment_line(struct dm_task *dmt, seg->vdo_params.block_map_era_length, seg->vdo_params.use_metadata_hints ?"on" :"off" , (seg->vdo_params.write_policy ==DM_VDO_WRITE_POLICY_SYNC ) ?"sync" : - (seg->vdo_params.write_policy ==DM_VDO_WRITE_POLICY_ASYNC ) ?"async" :"auto" ,// policy + (seg->vdo_params.write_policy ==DM_VDO_WRITE_POLICY_ASYNC ) ?"async" : + (seg->vdo_params.write_policy ==DM_VDO_WRITE_POLICY_ASYNC_UNSAFE ) ?"async-unsafe" :"auto" ,// policy seg->vdo_name, seg->vdo_params.max_discard, seg->vdo_params.ack_threads,
device_mapper/vdo/target.h +2 -1
@@ -69,7 +69,8 @@ bool dm_vdo_status_parse(struct dm_pool *mem, const char *input,enum dm_vdo_write_policy {DM_VDO_WRITE_POLICY_AUTO =0 ,DM_VDO_WRITE_POLICY_SYNC , -DM_VDO_WRITE_POLICY_ASYNC +DM_VDO_WRITE_POLICY_ASYNC , +DM_VDO_WRITE_POLICY_ASYNC_UNSAFE };// FIXME: review whether we should use the createParams from the userlib
device_mapper/vdo/vdo_target.c +1 -0
@@ -100,6 +100,7 @@ bool dm_vdo_validate_target_params(const struct dm_vdo_target_params *vtp,switch (vtp->write_policy) {case DM_VDO_WRITE_POLICY_SYNC :case DM_VDO_WRITE_POLICY_ASYNC : +case DM_VDO_WRITE_POLICY_ASYNC_UNSAFE :case DM_VDO_WRITE_POLICY_AUTO :break ;default :
lib/config/config_settings.h +3 -1
@@ -796,7 +796,9 @@ cfg(allocation_vdo_write_policy_CFG, "vdo_write_policy", allocation_CFG_SECTION,"sync - Writes are acknowledged only after data is stably written.\n" " This policy is not supported if the underlying storage is not also synchronous.\n" "async - Writes are acknowledged after data has been cached for writing to stable storage.\n" - " Data which has not been flushed is not guaranteed to persist in this mode.\n") +" Data which has not been flushed is not guaranteed to persist in this mode.\n" +"async-unsafe - Writes are handled like 'async' but there is no guarantee of the atomicity async provides.\n" + " This mode should only be used for better performance when atomicity is not required.\n") cfg(allocation_vdo_max_discard_CFG, "vdo_max_discard", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_PROFILABLE_METADATA | CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_VDO_MAX_DISCARD, VDO_1ST_VSN, NULL, 0, NULL,"Specified the maximum size of discard bio accepted, in 4096 byte blocks.\n"
lib/metadata/vdo_manip.c +4 -0
@@ -81,6 +81,8 @@ const char *get_vdo_write_policy_name(enum dm_vdo_write_policy policy)return "sync" ;case DM_VDO_WRITE_POLICY_ASYNC :return "async" ; +case DM_VDO_WRITE_POLICY_ASYNC_UNSAFE : +return "async-unsafe" ;default :log_debug (INTERNAL_ERROR "Unrecognized VDO write policy: %u." , policy);/* Fall through */
@@ -441,6 +443,8 @@ int set_vdo_write_policy(enum dm_vdo_write_policy *vwp, const char *policy) *vwp =DM_VDO_WRITE_POLICY_SYNC ; else if (strcasecmp(policy, "async") == 0) *vwp = DM_VDO_WRITE_POLICY_ASYNC; + else if (strcasecmp(policy, "async-unsafe") == 0) + *vwp = DM_VDO_WRITE_POLICY_ASYNC_UNSAFE; else if (strcasecmp(policy, "auto") == 0) *vwp = DM_VDO_WRITE_POLICY_AUTO; else {