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

thin_pool: introduce --pooldatavdo

Introducing new arg --pooldatavdo y|n
This commit is contained in:
Zdenek Kabelac 2023-12-07 19:17:35 +01:00
parent c496f80379
commit 4ccedceaa8
6 changed files with 24 additions and 4 deletions

View File

@ -1040,6 +1040,7 @@ struct lvcreate_params {
uint64_t pool_metadata_size; /* pools */ uint64_t pool_metadata_size; /* pools */
uint32_t pool_data_extents; /* pools */ uint32_t pool_data_extents; /* pools */
uint64_t pool_data_size; /* pools */ uint64_t pool_data_size; /* pools */
int pool_data_vdo; /* pools */
uint32_t virtual_extents; /* snapshots, thins */ uint32_t virtual_extents; /* snapshots, thins */
struct dm_list *pvh; /* all */ struct dm_list *pvh; /* all */

View File

@ -608,6 +608,9 @@ arg(polloperation_ARG, '\0', "polloperation", polloperation_VAL, 0, 0,
/* Not used. */ /* Not used. */
arg(pooldatasize_ARG, '\0', "pooldatasize", sizemb_VAL, 0, 0, NULL) arg(pooldatasize_ARG, '\0', "pooldatasize", sizemb_VAL, 0, 0, NULL)
arg(pooldatavdo_ARG, '\0', "pooldatavdo", bool_VAL, 0, 0,
"Use VDO type volume for pool data volume.\n")
arg(poolmetadata_ARG, '\0', "poolmetadata", lv_VAL, 0, 0, arg(poolmetadata_ARG, '\0', "poolmetadata", lv_VAL, 0, 0,
"The name of a an LV to use for storing pool metadata.\n") "The name of a an LV to use for storing pool metadata.\n")

View File

@ -3062,6 +3062,7 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
thin_discards_t discards; thin_discards_t discards;
thin_zero_t zero_new_blocks; thin_zero_t zero_new_blocks;
int error_when_full; int error_when_full;
int data_vdo;
int is_active; int is_active;
int ret = 1; int ret = 1;
@ -3185,7 +3186,7 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
} }
if (!get_pool_params(cmd, pool_segtype, if (!get_pool_params(cmd, pool_segtype,
&meta_size, &pool_metadata_spare, &data_vdo, &meta_size, &pool_metadata_spare,
&chunk_size, &discards, &zero_new_blocks)) &chunk_size, &discards, &zero_new_blocks))
goto_bad; goto_bad;

View File

@ -926,6 +926,7 @@ static int _lvcreate_params(struct cmd_context *cmd,
#define THIN_POOL_ARGS \ #define THIN_POOL_ARGS \
discards_ARG,\ discards_ARG,\
pooldatavdo_ARG,\
thinpool_ARG thinpool_ARG
#define VDO_POOL_ARGS \ #define VDO_POOL_ARGS \
@ -1225,7 +1226,7 @@ static int _lvcreate_params(struct cmd_context *cmd,
!_read_size_params(cmd, lp, lcp) || !_read_size_params(cmd, lp, lcp) ||
!get_stripe_params(cmd, lp->segtype, &lp->stripes, &lp->stripe_size, &lp->stripes_supplied, &lp->stripe_size_supplied) || !get_stripe_params(cmd, lp->segtype, &lp->stripes, &lp->stripe_size, &lp->stripes_supplied, &lp->stripe_size_supplied) ||
(lp->create_pool && (lp->create_pool &&
!get_pool_params(cmd, lp->segtype, !get_pool_params(cmd, lp->segtype, &lp->pool_data_vdo,
&lp->pool_metadata_size, &lp->pool_metadata_spare, &lp->pool_metadata_size, &lp->pool_metadata_spare,
&lp->chunk_size, &lp->discards, &lp->zero_new_blocks)) || &lp->chunk_size, &lp->discards, &lp->zero_new_blocks)) ||
!_read_cache_params(cmd, lp) || !_read_cache_params(cmd, lp) ||

View File

@ -953,13 +953,27 @@ int get_activation_monitoring_mode(struct cmd_context *cmd,
*/ */
int get_pool_params(struct cmd_context *cmd, int get_pool_params(struct cmd_context *cmd,
const struct segment_type *segtype, const struct segment_type *segtype,
int *pool_data_vdo,
uint64_t *pool_metadata_size, uint64_t *pool_metadata_size,
int *pool_metadata_spare, int *pool_metadata_spare,
uint32_t *chunk_size, uint32_t *chunk_size,
thin_discards_t *discards, thin_discards_t *discards,
thin_zero_t *zero_new_blocks) thin_zero_t *zero_new_blocks)
{ {
if (segtype_is_thin_pool(segtype) || segtype_is_thin(segtype)) { if ((*pool_data_vdo = arg_int_value(cmd, pooldatavdo_ARG, 0))) {
if (!(segtype = get_segtype_from_string(cmd, SEG_TYPE_NAME_VDO)))
return_0;
if (activation() && segtype->ops->target_present) {
if (!segtype->ops->target_present(cmd, NULL, NULL)) {
log_error("%s: Required device-mapper target(s) not detected in your kernel.",
segtype->name);
return_0;
}
}
}
if (segtype_is_thin_pool(segtype) || segtype_is_thin(segtype) || *pool_data_vdo) {
if (arg_is_set(cmd, zero_ARG)) { if (arg_is_set(cmd, zero_ARG)) {
*zero_new_blocks = arg_int_value(cmd, zero_ARG, 0) ? THIN_ZERO_YES : THIN_ZERO_NO; *zero_new_blocks = arg_int_value(cmd, zero_ARG, 0) ? THIN_ZERO_YES : THIN_ZERO_NO;
log_very_verbose("%s pool zeroing.", log_very_verbose("%s pool zeroing.",
@ -1011,7 +1025,6 @@ int get_pool_params(struct cmd_context *cmd,
} else } else
*pool_metadata_size = 0; *pool_metadata_size = 0;
/* TODO: default in lvm.conf and metadata profile ? */ /* TODO: default in lvm.conf and metadata profile ? */
*pool_metadata_spare = arg_int_value(cmd, poolmetadataspare_ARG, *pool_metadata_spare = arg_int_value(cmd, poolmetadataspare_ARG,
DEFAULT_POOL_METADATA_SPARE); DEFAULT_POOL_METADATA_SPARE);

View File

@ -200,6 +200,7 @@ int get_activation_monitoring_mode(struct cmd_context *cmd,
int get_pool_params(struct cmd_context *cmd, int get_pool_params(struct cmd_context *cmd,
const struct segment_type *segtype, const struct segment_type *segtype,
int *pool_data_vdo,
uint64_t *pool_metadata_size, uint64_t *pool_metadata_size,
int *pool_metadata_spare, int *pool_metadata_spare,
uint32_t *chunk_size, uint32_t *chunk_size,