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

toollib: Record whether or not stripes/stripe_size args supplied.

This commit is contained in:
Alasdair G Kergon 2016-08-19 13:51:43 +01:00
parent c27963c566
commit c1a0a2c712
5 changed files with 15 additions and 8 deletions

View File

@ -945,6 +945,9 @@ struct lvcreate_params {
uint32_t chunk_size; /* snapshot */
uint32_t region_size; /* mirror */
unsigned stripes_supplied; /* striped */
unsigned stripe_size_supplied; /* striped */
uint32_t mirrors; /* mirror */
uint32_t min_recovery_rate; /* RAID */

View File

@ -86,7 +86,8 @@ struct lvconvert_params {
sign_t mirrors_sign;
uint32_t stripes;
uint32_t stripe_size;
uint32_t stripe_size_supplied;
unsigned stripes_supplied;
unsigned stripe_size_supplied;
uint32_t read_ahead;
cache_mode_t cache_mode; /* cache */
const char *policy_name; /* cache */
@ -3183,7 +3184,7 @@ static int _lvconvert_pool(struct cmd_context *cmd,
return_0;
if (!get_stripe_params(cmd, get_segtype_from_string(cmd, SEG_TYPE_NAME_STRIPED),
&lp->stripes, &lp->stripe_size))
&lp->stripes, &lp->stripe_size, &lp->stripes_supplied, &lp->stripe_size_supplied))
return_0;
if (!archive(vg))
@ -4473,10 +4474,8 @@ static int _lvconvert(struct cmd_context *cmd, struct logical_volume *lv,
if (_mirror_or_raid_type_requested(cmd, lp->type_str) || _raid0_type_requested(lp->type_str) ||
_striped_type_requested(lp->type_str) || lp->repair || lp->mirrorlog || lp->corelog) {
/* FIXME Handle +/- adjustments too? */
if (!get_stripe_params(cmd, lp->segtype, &lp->stripes, &lp->stripe_size))
if (!get_stripe_params(cmd, lp->segtype, &lp->stripes, &lp->stripe_size, &lp->stripes_supplied, &lp->stripe_size_supplied))
return_0;
/* FIXME Move this into the get function */
lp->stripe_size_supplied = arg_is_set(cmd, stripesize_ARG);
if (_raid0_type_requested(lp->type_str) || _striped_type_requested(lp->type_str))
/* FIXME Shouldn't need to override get_stripe_params which defaults to 1 stripe (i.e. linear)! */

View File

@ -1061,7 +1061,7 @@ static int _lvcreate_params(struct cmd_context *cmd,
if (!_lvcreate_name_params(cmd, &argc, &argv, lp) ||
!_read_size_params(cmd, lp, lcp) ||
!get_stripe_params(cmd, lp->segtype, &lp->stripes, &lp->stripe_size) ||
!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, &lp->passed_args,
&lp->pool_metadata_size, &lp->pool_metadata_spare,

View File

@ -1318,13 +1318,17 @@ static int _validate_stripe_params(struct cmd_context *cmd, const struct segment
* power of 2, we must divide UINT_MAX by four and add 1 (to round it
* up to the power of 2)
*/
int get_stripe_params(struct cmd_context *cmd, const struct segment_type *segtype, uint32_t *stripes, uint32_t *stripe_size)
int get_stripe_params(struct cmd_context *cmd, const struct segment_type *segtype,
uint32_t *stripes, uint32_t *stripe_size,
unsigned *stripes_supplied, unsigned *stripe_size_supplied)
{
/* stripes_long_ARG takes precedence (for lvconvert) */
/* FIXME Cope with relative +/- changes for lvconvert. */
*stripes = arg_uint_value(cmd, arg_is_set(cmd, stripes_long_ARG) ? stripes_long_ARG : stripes_ARG, 1);
*stripes_supplied = arg_is_set(cmd, stripes_long_ARG) ? : arg_is_set(cmd, stripes_ARG);
*stripe_size = arg_uint_value(cmd, stripesize_ARG, 0);
*stripe_size_supplied = arg_is_set(cmd, stripesize_ARG);
if (*stripe_size) {
if (arg_sign_value(cmd, stripesize_ARG, SIGN_NONE) == SIGN_MINUS) {
log_error("Negative stripesize is invalid.");

View File

@ -197,7 +197,8 @@ int get_pool_params(struct cmd_context *cmd,
int *zero);
int get_stripe_params(struct cmd_context *cmd, const struct segment_type *segtype,
uint32_t *stripes, uint32_t *stripe_size);
uint32_t *stripes, uint32_t *stripe_size,
unsigned *stripes_supplied, unsigned *stripe_size_supplied);
int get_cache_params(struct cmd_context *cmd,
cache_mode_t *cache_mode,