mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
cleanup: indent
Various indents and tiny error message improvements.
This commit is contained in:
parent
c6456bd639
commit
4f8ed25a99
@ -6032,7 +6032,8 @@ int remove_layer_from_lv(struct logical_volume *lv,
|
|||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
/* Replace the empty layer with error segment */
|
/* Replace the empty layer with error segment */
|
||||||
segtype = get_segtype_from_string(lv->vg->cmd, "error");
|
if (!(segtype = get_segtype_from_string(lv->vg->cmd, "error")))
|
||||||
|
return_0;
|
||||||
if (!lv_add_virtual_segment(layer_lv, 0, parent->le_count, segtype, NULL))
|
if (!lv_add_virtual_segment(layer_lv, 0, parent->le_count, segtype, NULL))
|
||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
@ -6050,7 +6051,7 @@ struct logical_volume *insert_layer_for_lv(struct cmd_context *cmd,
|
|||||||
uint64_t status,
|
uint64_t status,
|
||||||
const char *layer_suffix)
|
const char *layer_suffix)
|
||||||
{
|
{
|
||||||
static char _suffixes[][8] = { "_tdata", "_cdata", "_corig" };
|
static const char _suffixes[][8] = { "_tdata", "_cdata", "_corig" };
|
||||||
int r;
|
int r;
|
||||||
char *name;
|
char *name;
|
||||||
size_t len;
|
size_t len;
|
||||||
@ -6129,7 +6130,6 @@ struct logical_volume *insert_layer_for_lv(struct cmd_context *cmd,
|
|||||||
/* Remove the temporary tags */
|
/* Remove the temporary tags */
|
||||||
dm_list_iterate_items(sl, &lv_where->tags)
|
dm_list_iterate_items(sl, &lv_where->tags)
|
||||||
str_list_del(&layer_lv->tags, sl->str);
|
str_list_del(&layer_lv->tags, sl->str);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log_very_verbose("Inserting layer %s for %s",
|
log_very_verbose("Inserting layer %s for %s",
|
||||||
@ -6166,7 +6166,7 @@ struct logical_volume *insert_layer_for_lv(struct cmd_context *cmd,
|
|||||||
lv_names.old = lv_where->name;
|
lv_names.old = lv_where->name;
|
||||||
lv_names.new = layer_lv->name;
|
lv_names.new = layer_lv->name;
|
||||||
if (!for_each_sub_lv(layer_lv, _rename_cb, (void *) &lv_names))
|
if (!for_each_sub_lv(layer_lv, _rename_cb, (void *) &lv_names))
|
||||||
return 0;
|
return_NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6635,8 +6635,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (lp->stripe_size > vg->extent_size) {
|
if (lp->stripe_size > vg->extent_size) {
|
||||||
if (segtype_is_raid(lp->segtype) &&
|
if (seg_is_raid(lp) && (vg->extent_size < STRIPE_SIZE_MIN)) {
|
||||||
(vg->extent_size < STRIPE_SIZE_MIN)) {
|
|
||||||
/*
|
/*
|
||||||
* FIXME: RAID will simply fail to load the table if
|
* FIXME: RAID will simply fail to load the table if
|
||||||
* this is the case, but we should probably
|
* this is the case, but we should probably
|
||||||
@ -6677,13 +6676,12 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
|
|||||||
|
|
||||||
if (seg_is_cache(lp)) {
|
if (seg_is_cache(lp)) {
|
||||||
if (!lp->pool_name) {
|
if (!lp->pool_name) {
|
||||||
log_error(INTERNAL_ERROR "Cannot create cached volume without cache pool.");
|
log_error(INTERNAL_ERROR "Cannot create thin volume without thin pool.");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/* We have the cache_pool, create the origin with cache */
|
|
||||||
if (!(pool_lv = find_lv(vg, lp->pool_name))) {
|
if (!(pool_lv = find_lv(vg, lp->pool_name))) {
|
||||||
log_error("Couldn't find cache pool volume %s in "
|
log_error("Couldn't find volume %s in Volume group %s.",
|
||||||
"volume group %s.", lp->pool_name, vg->name);
|
lp->pool_name, vg->name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6744,8 +6742,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (lv_is_locked(origin_lv)) {
|
if (lv_is_locked(origin_lv)) {
|
||||||
log_error("Snapshots of locked devices are not "
|
log_error("Snapshots of locked devices are not supported.");
|
||||||
"supported yet");
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (lv_is_merging_origin(origin_lv)) {
|
if (lv_is_merging_origin(origin_lv)) {
|
||||||
@ -6871,16 +6868,16 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
|
|||||||
return_NULL;
|
return_NULL;
|
||||||
|
|
||||||
if (lp->read_ahead != lv->read_ahead) {
|
if (lp->read_ahead != lv->read_ahead) {
|
||||||
log_verbose("Setting read ahead sectors");
|
|
||||||
lv->read_ahead = lp->read_ahead;
|
lv->read_ahead = lp->read_ahead;
|
||||||
|
log_debug_metadata("Setting read ahead sectors %u.", lv->read_ahead);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!seg_is_thin_pool(lp) && lp->minor >= 0) {
|
if (!seg_is_thin_pool(lp) && lp->minor >= 0) {
|
||||||
lv->major = lp->major;
|
lv->major = lp->major;
|
||||||
lv->minor = lp->minor;
|
lv->minor = lp->minor;
|
||||||
lv->status |= FIXED_MINOR;
|
lv->status |= FIXED_MINOR;
|
||||||
log_verbose("Setting device number to (%d, %d)", lv->major,
|
log_debug_metadata("Setting device number to (%d, %d).",
|
||||||
lv->minor);
|
lv->major, lv->minor);
|
||||||
}
|
}
|
||||||
|
|
||||||
dm_list_splice(&lv->tags, &lp->tags);
|
dm_list_splice(&lv->tags, &lp->tags);
|
||||||
@ -6963,8 +6960,8 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
|
|||||||
* it just as if CHANGE_AY was used, CHANGE_AN otherwise.
|
* it just as if CHANGE_AY was used, CHANGE_AN otherwise.
|
||||||
*/
|
*/
|
||||||
if (lp->activate == CHANGE_AAY)
|
if (lp->activate == CHANGE_AAY)
|
||||||
lp->activate = lv_passes_auto_activation_filter(cmd, lv) ?
|
lp->activate = lv_passes_auto_activation_filter(cmd, lv)
|
||||||
CHANGE_ALY : CHANGE_ALN;
|
? CHANGE_ALY : CHANGE_ALN;
|
||||||
|
|
||||||
if (lv_activation_skip(lv, lp->activate, lp->activation_skip & ACTIVATION_SKIP_IGNORE))
|
if (lv_activation_skip(lv, lp->activate, lp->activation_skip & ACTIVATION_SKIP_IGNORE))
|
||||||
lp->activate = CHANGE_AN;
|
lp->activate = CHANGE_AN;
|
||||||
@ -7100,9 +7097,8 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
|
|||||||
.yes = lp->yes,
|
.yes = lp->yes,
|
||||||
.force = lp->force
|
.force = lp->force
|
||||||
})) {
|
})) {
|
||||||
log_error("Aborting. Failed to wipe %s.",
|
log_error("Aborting. Failed to wipe %s.", lp->snapshot
|
||||||
lp->snapshot ? "snapshot exception store" :
|
? "snapshot exception store" : "start of new LV");
|
||||||
"start of new LV");
|
|
||||||
goto deactivate_and_revert_new_lv;
|
goto deactivate_and_revert_new_lv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7120,8 +7116,8 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
|
|||||||
if ((vg_is_clustered(vg) ||
|
if ((vg_is_clustered(vg) ||
|
||||||
(!lp->voriginsize && !lv_is_active(origin_lv))) &&
|
(!lp->voriginsize && !lv_is_active(origin_lv))) &&
|
||||||
!deactivate_lv(cmd, lv)) {
|
!deactivate_lv(cmd, lv)) {
|
||||||
log_error("Aborting. Couldn't deactivate snapshot "
|
log_error("Aborting. Couldn't deactivate snapshot COW area. "
|
||||||
"COW area. Manual intervention required.");
|
"Manual intervention required.");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7150,9 +7146,8 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
|
|||||||
|
|
||||||
/* store vg on disk(s) */
|
/* store vg on disk(s) */
|
||||||
if (!lv_update_and_reload(origin_lv))
|
if (!lv_update_and_reload(origin_lv))
|
||||||
return_0;
|
return_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
return lv;
|
return lv;
|
||||||
|
|
||||||
|
@ -783,7 +783,7 @@ int is_mirror_image_removable(struct logical_volume *mimage_lv, void *baton);
|
|||||||
typedef enum activation_change {
|
typedef enum activation_change {
|
||||||
CHANGE_AY = 0, /* activate */
|
CHANGE_AY = 0, /* activate */
|
||||||
CHANGE_AN = 1, /* deactivate */
|
CHANGE_AN = 1, /* deactivate */
|
||||||
CHANGE_AEY = 2, /* activate exclusively */
|
CHANGE_AEY = 2, /* activate exclusively */
|
||||||
CHANGE_ALY = 3, /* activate locally */
|
CHANGE_ALY = 3, /* activate locally */
|
||||||
CHANGE_ALN = 4, /* deactivate locally */
|
CHANGE_ALN = 4, /* deactivate locally */
|
||||||
CHANGE_AAY = 5 /* automatic activation */
|
CHANGE_AAY = 5 /* automatic activation */
|
||||||
@ -801,7 +801,7 @@ struct lvcreate_params {
|
|||||||
int cache;
|
int cache;
|
||||||
int snapshot; /* snap */
|
int snapshot; /* snap */
|
||||||
int thin; /* thin */
|
int thin; /* thin */
|
||||||
int create_pool; /* thin */
|
int create_pool; /* pools */
|
||||||
int zero; /* all */
|
int zero; /* all */
|
||||||
int wipe_signatures; /* all */
|
int wipe_signatures; /* all */
|
||||||
int32_t major; /* all */
|
int32_t major; /* all */
|
||||||
|
@ -433,7 +433,7 @@ int create_pool(struct logical_volume *pool_lv,
|
|||||||
*/
|
*/
|
||||||
pool_lv->status |= LV_TEMPORARY;
|
pool_lv->status |= LV_TEMPORARY;
|
||||||
if (!activate_lv_local(pool_lv->vg->cmd, pool_lv) ||
|
if (!activate_lv_local(pool_lv->vg->cmd, pool_lv) ||
|
||||||
/* Clear 4KB of metadata device for new thin-pool. */
|
/* Clear 4KB of pool metadata device. */
|
||||||
!wipe_lv(pool_lv, (struct wipe_params) { .do_zero = 1 })) {
|
!wipe_lv(pool_lv, (struct wipe_params) { .do_zero = 1 })) {
|
||||||
log_error("Aborting. Failed to wipe pool metadata %s.",
|
log_error("Aborting. Failed to wipe pool metadata %s.",
|
||||||
pool_lv->name);
|
pool_lv->name);
|
||||||
|
@ -390,8 +390,8 @@ static int _update_extents_params(struct volume_group *vg,
|
|||||||
extents = percent_of_extents(lp->extents, vg->extent_count, 0);
|
extents = percent_of_extents(lp->extents, vg->extent_count, 0);
|
||||||
break;
|
break;
|
||||||
case PERCENT_LV:
|
case PERCENT_LV:
|
||||||
log_error("Please express size as %s%%VG, %%PVS, "
|
log_error("Please express size as %%FREE%s, %%PVS or %%VG.",
|
||||||
"or %%FREE.", (lp->snapshot) ? "%ORIGIN, " : "");
|
(lp->snapshot) ? ", %ORIGIN" : "");
|
||||||
return 0;
|
return 0;
|
||||||
case PERCENT_ORIGIN:
|
case PERCENT_ORIGIN:
|
||||||
if (lp->snapshot && lp->origin_name &&
|
if (lp->snapshot && lp->origin_name &&
|
||||||
@ -667,8 +667,7 @@ static int _read_raid_params(struct lvcreate_params *lp,
|
|||||||
/*
|
/*
|
||||||
* RAID1 does not take a stripe arg
|
* RAID1 does not take a stripe arg
|
||||||
*/
|
*/
|
||||||
if ((lp->stripes > 1) &&
|
if ((lp->stripes > 1) && seg_is_mirrored(lp) &&
|
||||||
segtype_is_mirrored(lp->segtype) &&
|
|
||||||
strcmp(lp->segtype->name, SEG_TYPE_NAME_RAID10)) {
|
strcmp(lp->segtype->name, SEG_TYPE_NAME_RAID10)) {
|
||||||
log_error("Stripe argument cannot be used with segment type, %s",
|
log_error("Stripe argument cannot be used with segment type, %s",
|
||||||
lp->segtype->name);
|
lp->segtype->name);
|
||||||
@ -713,11 +712,10 @@ static int _read_cache_pool_params(struct lvcreate_params *lp,
|
|||||||
{
|
{
|
||||||
const char *cachemode;
|
const char *cachemode;
|
||||||
|
|
||||||
if (!segtype_is_cache_pool(lp->segtype))
|
if (!seg_is_cache(lp) && !seg_is_cache_pool(lp))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
cachemode = arg_str_value(cmd, cachemode_ARG, NULL);
|
if (!(cachemode = arg_str_value(cmd, cachemode_ARG, NULL)))
|
||||||
if (!cachemode)
|
|
||||||
cachemode = find_config_tree_str(cmd, allocation_cache_pool_cachemode_CFG, NULL);
|
cachemode = find_config_tree_str(cmd, allocation_cache_pool_cachemode_CFG, NULL);
|
||||||
|
|
||||||
if (!get_cache_mode(cachemode, &lp->feature_flags))
|
if (!get_cache_mode(cachemode, &lp->feature_flags))
|
||||||
@ -748,9 +746,7 @@ static int _read_activation_params(struct lvcreate_params *lp,
|
|||||||
lp->zero = 0;
|
lp->zero = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Read ahead */
|
||||||
* Read ahead.
|
|
||||||
*/
|
|
||||||
lp->read_ahead = arg_uint_value(cmd, readahead_ARG,
|
lp->read_ahead = arg_uint_value(cmd, readahead_ARG,
|
||||||
cmd->default_settings.read_ahead);
|
cmd->default_settings.read_ahead);
|
||||||
pagesize = lvm_getpagesize() >> SECTOR_SHIFT;
|
pagesize = lvm_getpagesize() >> SECTOR_SHIFT;
|
||||||
@ -765,9 +761,7 @@ static int _read_activation_params(struct lvcreate_params *lp,
|
|||||||
"of %uK page size.", lp->read_ahead, pagesize >> 1);
|
"of %uK page size.", lp->read_ahead, pagesize >> 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Permissions */
|
||||||
* Permissions.
|
|
||||||
*/
|
|
||||||
lp->permission = arg_uint_value(cmd, permission_ARG,
|
lp->permission = arg_uint_value(cmd, permission_ARG,
|
||||||
LVM_READ | LVM_WRITE);
|
LVM_READ | LVM_WRITE);
|
||||||
|
|
||||||
@ -790,7 +784,7 @@ static int _read_activation_params(struct lvcreate_params *lp,
|
|||||||
|
|
||||||
if (!get_and_validate_major_minor(cmd, vg->fid->fmt,
|
if (!get_and_validate_major_minor(cmd, vg->fid->fmt,
|
||||||
&lp->major, &lp->minor))
|
&lp->major, &lp->minor))
|
||||||
return_0;
|
return_0;
|
||||||
} else if (arg_is_set(cmd, major_ARG) || arg_is_set(cmd, minor_ARG)) {
|
} else if (arg_is_set(cmd, major_ARG) || arg_is_set(cmd, minor_ARG)) {
|
||||||
log_error("--major and --minor require -My.");
|
log_error("--major and --minor require -My.");
|
||||||
return 0;
|
return 0;
|
||||||
@ -1048,13 +1042,11 @@ static int _lvcreate_params(struct lvcreate_params *lp,
|
|||||||
* Allocation parameters
|
* Allocation parameters
|
||||||
*/
|
*/
|
||||||
contiguous = arg_int_value(cmd, contiguous_ARG, 0);
|
contiguous = arg_int_value(cmd, contiguous_ARG, 0);
|
||||||
|
|
||||||
lp->alloc = contiguous ? ALLOC_CONTIGUOUS : ALLOC_INHERIT;
|
lp->alloc = contiguous ? ALLOC_CONTIGUOUS : ALLOC_INHERIT;
|
||||||
|
|
||||||
lp->alloc = (alloc_policy_t) arg_uint_value(cmd, alloc_ARG, lp->alloc);
|
lp->alloc = (alloc_policy_t) arg_uint_value(cmd, alloc_ARG, lp->alloc);
|
||||||
|
|
||||||
if (contiguous && (lp->alloc != ALLOC_CONTIGUOUS)) {
|
if (contiguous && (lp->alloc != ALLOC_CONTIGUOUS)) {
|
||||||
log_error("Conflicting contiguous and alloc arguments");
|
log_error("Conflicting contiguous and alloc arguments.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1063,12 +1055,12 @@ static int _lvcreate_params(struct lvcreate_params *lp,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!(tag = grouped_arg_str_value(current_group->arg_values, addtag_ARG, NULL))) {
|
if (!(tag = grouped_arg_str_value(current_group->arg_values, addtag_ARG, NULL))) {
|
||||||
log_error("Failed to get tag");
|
log_error("Failed to get tag.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!str_list_add(cmd->mem, &lp->tags, tag)) {
|
if (!str_list_add(cmd->mem, &lp->tags, tag)) {
|
||||||
log_error("Unable to allocate memory for tag %s", tag);
|
log_error("Unable to allocate memory for tag %s.", tag);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user