mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
cleanup: plain code reindent
Just simple reindent and brace changes.
This commit is contained in:
parent
ad376e9e00
commit
126463ad1f
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2011 Red Hat, Inc. All rights reserved.
|
||||
* Copyright (C) 2011-2014 Red Hat, Inc. All rights reserved.
|
||||
*
|
||||
* This file is part of LVM2.
|
||||
*
|
||||
@ -26,10 +26,9 @@ static int _lv_is_raid_with_tracking(const struct logical_volume *lv,
|
||||
struct logical_volume **tracking)
|
||||
{
|
||||
uint32_t s;
|
||||
struct lv_segment *seg;
|
||||
const struct lv_segment *seg = first_seg(lv);
|
||||
|
||||
*tracking = NULL;
|
||||
seg = first_seg(lv);
|
||||
|
||||
if (!(lv->status & RAID))
|
||||
return 0;
|
||||
@ -39,7 +38,6 @@ static int _lv_is_raid_with_tracking(const struct logical_volume *lv,
|
||||
!(seg_lv(seg, s)->status & LVM_WRITE))
|
||||
*tracking = seg_lv(seg, s);
|
||||
|
||||
|
||||
return *tracking ? 1 : 0;
|
||||
}
|
||||
|
||||
@ -130,11 +128,8 @@ static int _raid_remove_top_layer(struct logical_volume *lv,
|
||||
return 0;
|
||||
}
|
||||
|
||||
lvl_array = dm_pool_alloc(lv->vg->vgmem, 2 * sizeof(*lvl));
|
||||
if (!lvl_array) {
|
||||
log_error("Memory allocation failed.");
|
||||
return 0;
|
||||
}
|
||||
if (!(lvl_array = dm_pool_alloc(lv->vg->vgmem, 2 * sizeof(*lvl))))
|
||||
return_0;
|
||||
|
||||
/* Add last metadata area to removal_list */
|
||||
lvl_array[0].lv = seg_metalv(seg, 0);
|
||||
@ -154,6 +149,7 @@ static int _raid_remove_top_layer(struct logical_volume *lv,
|
||||
return_0;
|
||||
|
||||
lv->status &= ~(MIRRORED | RAID);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -385,9 +381,8 @@ static int _alloc_image_component(struct logical_volume *lv,
|
||||
}
|
||||
|
||||
status = LVM_READ | LVM_WRITE | LV_REBUILD | type;
|
||||
tmp_lv = lv_create_empty(img_name, NULL, status, ALLOC_INHERIT, lv->vg);
|
||||
if (!tmp_lv) {
|
||||
log_error("Failed to allocate new raid component, %s", img_name);
|
||||
if (!(tmp_lv = lv_create_empty(img_name, NULL, status, ALLOC_INHERIT, lv->vg))) {
|
||||
log_error("Failed to allocate new raid component, %s.", img_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -419,9 +414,8 @@ static int _alloc_image_components(struct logical_volume *lv,
|
||||
struct logical_volume *tmp_lv;
|
||||
struct lv_list *lvl_array;
|
||||
|
||||
lvl_array = dm_pool_alloc(lv->vg->vgmem,
|
||||
sizeof(*lvl_array) * count * 2);
|
||||
if (!lvl_array)
|
||||
if (!(lvl_array = dm_pool_alloc(lv->vg->vgmem,
|
||||
sizeof(*lvl_array) * count * 2)))
|
||||
return_0;
|
||||
|
||||
if (!(parallel_areas = build_parallel_areas_from_lv(lv, 0, 1)))
|
||||
@ -454,7 +448,7 @@ static int _alloc_image_components(struct logical_volume *lv,
|
||||
lv->alloc, 0, parallel_areas)))
|
||||
return_0;
|
||||
|
||||
for (s = 0; s < count; s++) {
|
||||
for (s = 0; s < count; ++s) {
|
||||
/*
|
||||
* The allocation areas are grouped together. First
|
||||
* come the rimage allocated areas, then come the metadata
|
||||
@ -473,7 +467,9 @@ static int _alloc_image_components(struct logical_volume *lv,
|
||||
lvl_array[s].lv = tmp_lv;
|
||||
dm_list_add(new_data_lvs, &(lvl_array[s].list));
|
||||
}
|
||||
|
||||
alloc_destroy(ah);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -523,6 +519,7 @@ static int _alloc_rmeta_for_lv(struct logical_volume *data_lv,
|
||||
return_0;
|
||||
|
||||
alloc_destroy(ah);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -736,13 +733,14 @@ to be left for these sub-lvs.
|
||||
|
||||
fail:
|
||||
/* Cleanly remove newly-allocated LVs that failed insertion attempt */
|
||||
|
||||
dm_list_iterate_items(lvl, &meta_lvs)
|
||||
if (!lv_remove(lvl->lv))
|
||||
return_0;
|
||||
|
||||
dm_list_iterate_items(lvl, &data_lvs)
|
||||
if (!lv_remove(lvl->lv))
|
||||
return_0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -841,9 +839,8 @@ static int _raid_extract_images(struct logical_volume *lv, uint32_t new_count,
|
||||
return 0;
|
||||
}
|
||||
|
||||
lvl_array = dm_pool_alloc(lv->vg->vgmem,
|
||||
sizeof(*lvl_array) * extract * 2);
|
||||
if (!lvl_array)
|
||||
if (!(lvl_array = dm_pool_alloc(lv->vg->vgmem,
|
||||
sizeof(*lvl_array) * extract * 2)))
|
||||
return_0;
|
||||
|
||||
if (!(error_segtype = get_segtype_from_string(lv->vg->cmd, "error")))
|
||||
@ -1096,7 +1093,8 @@ int lv_raid_split(struct logical_volume *lv, const char *split_name,
|
||||
"while tracking changes for %s",
|
||||
lv->name, tracking->name);
|
||||
return 0;
|
||||
} else {
|
||||
}
|
||||
|
||||
/* Ensure we only split the tracking image */
|
||||
dm_list_init(&tracking_pvs);
|
||||
splittable_pvs = &tracking_pvs;
|
||||
@ -1104,7 +1102,6 @@ int lv_raid_split(struct logical_volume *lv, const char *split_name,
|
||||
tracking, splittable_pvs))
|
||||
return_0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!_raid_extract_images(lv, new_count, splittable_pvs, 1,
|
||||
&removal_list, &data_list)) {
|
||||
@ -1152,6 +1149,7 @@ int lv_raid_split(struct logical_volume *lv, const char *split_name,
|
||||
*/
|
||||
if (!activate_lv_excl_local(cmd, lvl->lv))
|
||||
return_0;
|
||||
|
||||
dm_list_iterate_items(lvl, &removal_list)
|
||||
if (!activate_lv_excl_local(cmd, lvl->lv))
|
||||
return_0;
|
||||
@ -1217,7 +1215,7 @@ int lv_raid_split_and_track(struct logical_volume *lv,
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (s = seg->area_count - 1; s >= 0; s--) {
|
||||
for (s = seg->area_count - 1; s >= 0; --s) {
|
||||
if (!lv_is_on_pvs(seg_lv(seg, s), splittable_pvs))
|
||||
continue;
|
||||
lv_set_visible(seg_lv(seg, s));
|
||||
@ -1277,13 +1275,13 @@ int lv_raid_merge(struct logical_volume *image_lv)
|
||||
vg->name, image_lv->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
lv = lvl->lv;
|
||||
seg = first_seg(lv);
|
||||
for (s = 0; s < seg->area_count; s++) {
|
||||
if (seg_lv(seg, s) == image_lv) {
|
||||
for (s = 0; s < seg->area_count; ++s)
|
||||
if (seg_lv(seg, s) == image_lv)
|
||||
meta_lv = seg_metalv(seg, s);
|
||||
}
|
||||
}
|
||||
|
||||
if (!meta_lv)
|
||||
return_0;
|
||||
|
||||
@ -1327,10 +1325,9 @@ static int _convert_mirror_to_raid1(struct logical_volume *lv,
|
||||
return 0;
|
||||
}
|
||||
|
||||
meta_areas = dm_pool_zalloc(lv->vg->vgmem,
|
||||
lv_mirror_count(lv) * sizeof(*meta_areas));
|
||||
if (!meta_areas) {
|
||||
log_error("Failed to allocate memory");
|
||||
if (!(meta_areas = dm_pool_zalloc(lv->vg->vgmem,
|
||||
lv_mirror_count(lv) * sizeof(*meta_areas)))) {
|
||||
log_error("Failed to allocate meta areas memory.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1836,7 +1833,7 @@ static int _partial_raid_lv_is_redundant(struct logical_volume *lv)
|
||||
rebuilds_per_group++;
|
||||
|
||||
if (rebuilds_per_group >= copies) {
|
||||
log_verbose("An entire mirror group has failed in %s",
|
||||
log_verbose("An entire mirror group has failed in %s.",
|
||||
display_lvname(lv));
|
||||
return 0; /* Insufficient redundancy to activate */
|
||||
}
|
||||
@ -1854,12 +1851,12 @@ static int _partial_raid_lv_is_redundant(struct logical_volume *lv)
|
||||
}
|
||||
|
||||
if (failed_components == raid_seg->area_count) {
|
||||
log_verbose("All components of raid LV %s have failed",
|
||||
log_verbose("All components of raid LV %s have failed.",
|
||||
display_lvname(lv));
|
||||
return 0; /* Insufficient redundancy to activate */
|
||||
} else if (raid_seg->segtype->parity_devs &&
|
||||
(failed_components > raid_seg->segtype->parity_devs)) {
|
||||
log_verbose("More than %u components from %s %s have failed",
|
||||
log_verbose("More than %u components from %s %s have failed.",
|
||||
raid_seg->segtype->parity_devs,
|
||||
raid_seg->segtype->ops->name(raid_seg),
|
||||
display_lvname(lv));
|
||||
|
Loading…
Reference in New Issue
Block a user