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:
parent
c496f80379
commit
4ccedceaa8
@ -1040,6 +1040,7 @@ struct lvcreate_params {
|
||||
uint64_t pool_metadata_size; /* pools */
|
||||
uint32_t pool_data_extents; /* pools */
|
||||
uint64_t pool_data_size; /* pools */
|
||||
int pool_data_vdo; /* pools */
|
||||
uint32_t virtual_extents; /* snapshots, thins */
|
||||
struct dm_list *pvh; /* all */
|
||||
|
||||
|
@ -608,6 +608,9 @@ arg(polloperation_ARG, '\0', "polloperation", polloperation_VAL, 0, 0,
|
||||
/* Not used. */
|
||||
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,
|
||||
"The name of a an LV to use for storing pool metadata.\n")
|
||||
|
||||
|
@ -3062,6 +3062,7 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
|
||||
thin_discards_t discards;
|
||||
thin_zero_t zero_new_blocks;
|
||||
int error_when_full;
|
||||
int data_vdo;
|
||||
int is_active;
|
||||
int ret = 1;
|
||||
|
||||
@ -3185,7 +3186,7 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
|
||||
}
|
||||
|
||||
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))
|
||||
goto_bad;
|
||||
|
||||
|
@ -926,6 +926,7 @@ static int _lvcreate_params(struct cmd_context *cmd,
|
||||
|
||||
#define THIN_POOL_ARGS \
|
||||
discards_ARG,\
|
||||
pooldatavdo_ARG,\
|
||||
thinpool_ARG
|
||||
|
||||
#define VDO_POOL_ARGS \
|
||||
@ -1225,7 +1226,7 @@ static int _lvcreate_params(struct cmd_context *cmd,
|
||||
!_read_size_params(cmd, lp, lcp) ||
|
||||
!get_stripe_params(cmd, lp->segtype, &lp->stripes, &lp->stripe_size, &lp->stripes_supplied, &lp->stripe_size_supplied) ||
|
||||
(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->chunk_size, &lp->discards, &lp->zero_new_blocks)) ||
|
||||
!_read_cache_params(cmd, lp) ||
|
||||
|
@ -953,13 +953,27 @@ int get_activation_monitoring_mode(struct cmd_context *cmd,
|
||||
*/
|
||||
int get_pool_params(struct cmd_context *cmd,
|
||||
const struct segment_type *segtype,
|
||||
int *pool_data_vdo,
|
||||
uint64_t *pool_metadata_size,
|
||||
int *pool_metadata_spare,
|
||||
uint32_t *chunk_size,
|
||||
thin_discards_t *discards,
|
||||
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)) {
|
||||
*zero_new_blocks = arg_int_value(cmd, zero_ARG, 0) ? THIN_ZERO_YES : THIN_ZERO_NO;
|
||||
log_very_verbose("%s pool zeroing.",
|
||||
@ -1011,7 +1025,6 @@ int get_pool_params(struct cmd_context *cmd,
|
||||
} else
|
||||
*pool_metadata_size = 0;
|
||||
|
||||
|
||||
/* TODO: default in lvm.conf and metadata profile ? */
|
||||
*pool_metadata_spare = arg_int_value(cmd, poolmetadataspare_ARG,
|
||||
DEFAULT_POOL_METADATA_SPARE);
|
||||
|
@ -200,6 +200,7 @@ int get_activation_monitoring_mode(struct cmd_context *cmd,
|
||||
|
||||
int get_pool_params(struct cmd_context *cmd,
|
||||
const struct segment_type *segtype,
|
||||
int *pool_data_vdo,
|
||||
uint64_t *pool_metadata_size,
|
||||
int *pool_metadata_spare,
|
||||
uint32_t *chunk_size,
|
||||
|
Loading…
Reference in New Issue
Block a user