1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

vdo: add support for auto-unsafe writePolicy

This vdoWritePolicy policy missed matching support in lvm2.
This commit is contained in:
Zdenek Kabelac 2021-09-06 13:56:40 +02:00
parent 337053c56a
commit 79427151dc
7 changed files with 15 additions and 3 deletions

View File

@ -1,5 +1,6 @@
Version 2.03.14 - Version 2.03.14 -
================================== ==================================
Add support for VDO async-unsage write policy.
Improve lvm_import_vdo script. Improve lvm_import_vdo script.
Support VDO LV with lvcreate -ky. Support VDO LV with lvcreate -ky.
Fix lvconvert for VDO LV bigger then 2T. Fix lvconvert for VDO LV bigger then 2T.

View File

@ -713,6 +713,8 @@ allocation {
# This policy is not supported if the underlying storage is not also synchronous. # 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. # 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. # 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. # This configuration option has an automatic default value.
# vdo_write_policy = "auto" # vdo_write_policy = "auto"

View File

@ -2885,7 +2885,8 @@ static int _vdo_emit_segment_line(struct dm_task *dmt,
seg->vdo_params.block_map_era_length, seg->vdo_params.block_map_era_length,
seg->vdo_params.use_metadata_hints ? "on" : "off" , 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_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_name,
seg->vdo_params.max_discard, seg->vdo_params.max_discard,
seg->vdo_params.ack_threads, seg->vdo_params.ack_threads,

View File

@ -69,7 +69,8 @@ bool dm_vdo_status_parse(struct dm_pool *mem, const char *input,
enum dm_vdo_write_policy { enum dm_vdo_write_policy {
DM_VDO_WRITE_POLICY_AUTO = 0, DM_VDO_WRITE_POLICY_AUTO = 0,
DM_VDO_WRITE_POLICY_SYNC, 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 // FIXME: review whether we should use the createParams from the userlib

View File

@ -100,6 +100,7 @@ bool dm_vdo_validate_target_params(const struct dm_vdo_target_params *vtp,
switch (vtp->write_policy) { switch (vtp->write_policy) {
case DM_VDO_WRITE_POLICY_SYNC: case DM_VDO_WRITE_POLICY_SYNC:
case DM_VDO_WRITE_POLICY_ASYNC: case DM_VDO_WRITE_POLICY_ASYNC:
case DM_VDO_WRITE_POLICY_ASYNC_UNSAFE:
case DM_VDO_WRITE_POLICY_AUTO: case DM_VDO_WRITE_POLICY_AUTO:
break; break;
default: default:

View File

@ -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" "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" " 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" "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, 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" "Specified the maximum size of discard bio accepted, in 4096 byte blocks.\n"

View File

@ -81,6 +81,8 @@ const char *get_vdo_write_policy_name(enum dm_vdo_write_policy policy)
return "sync"; return "sync";
case DM_VDO_WRITE_POLICY_ASYNC: case DM_VDO_WRITE_POLICY_ASYNC:
return "async"; return "async";
case DM_VDO_WRITE_POLICY_ASYNC_UNSAFE:
return "async-unsafe";
default: default:
log_debug(INTERNAL_ERROR "Unrecognized VDO write policy: %u.", policy); log_debug(INTERNAL_ERROR "Unrecognized VDO write policy: %u.", policy);
/* Fall through */ /* 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; *vwp = DM_VDO_WRITE_POLICY_SYNC;
else if (strcasecmp(policy, "async") == 0) else if (strcasecmp(policy, "async") == 0)
*vwp = DM_VDO_WRITE_POLICY_ASYNC; *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) else if (strcasecmp(policy, "auto") == 0)
*vwp = DM_VDO_WRITE_POLICY_AUTO; *vwp = DM_VDO_WRITE_POLICY_AUTO;
else { else {