mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +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.
|
* 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)
|
struct logical_volume **tracking)
|
||||||
{
|
{
|
||||||
uint32_t s;
|
uint32_t s;
|
||||||
struct lv_segment *seg;
|
const struct lv_segment *seg = first_seg(lv);
|
||||||
|
|
||||||
*tracking = NULL;
|
*tracking = NULL;
|
||||||
seg = first_seg(lv);
|
|
||||||
|
|
||||||
if (!(lv->status & RAID))
|
if (!(lv->status & RAID))
|
||||||
return 0;
|
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))
|
!(seg_lv(seg, s)->status & LVM_WRITE))
|
||||||
*tracking = seg_lv(seg, s);
|
*tracking = seg_lv(seg, s);
|
||||||
|
|
||||||
|
|
||||||
return *tracking ? 1 : 0;
|
return *tracking ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,11 +128,8 @@ static int _raid_remove_top_layer(struct logical_volume *lv,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
lvl_array = dm_pool_alloc(lv->vg->vgmem, 2 * sizeof(*lvl));
|
if (!(lvl_array = dm_pool_alloc(lv->vg->vgmem, 2 * sizeof(*lvl))))
|
||||||
if (!lvl_array) {
|
return_0;
|
||||||
log_error("Memory allocation failed.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Add last metadata area to removal_list */
|
/* Add last metadata area to removal_list */
|
||||||
lvl_array[0].lv = seg_metalv(seg, 0);
|
lvl_array[0].lv = seg_metalv(seg, 0);
|
||||||
@ -154,6 +149,7 @@ static int _raid_remove_top_layer(struct logical_volume *lv,
|
|||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
lv->status &= ~(MIRRORED | RAID);
|
lv->status &= ~(MIRRORED | RAID);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -385,9 +381,8 @@ static int _alloc_image_component(struct logical_volume *lv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
status = LVM_READ | LVM_WRITE | LV_REBUILD | type;
|
status = LVM_READ | LVM_WRITE | LV_REBUILD | type;
|
||||||
tmp_lv = lv_create_empty(img_name, NULL, status, ALLOC_INHERIT, lv->vg);
|
if (!(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);
|
||||||
log_error("Failed to allocate new raid component, %s", img_name);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,9 +414,8 @@ static int _alloc_image_components(struct logical_volume *lv,
|
|||||||
struct logical_volume *tmp_lv;
|
struct logical_volume *tmp_lv;
|
||||||
struct lv_list *lvl_array;
|
struct lv_list *lvl_array;
|
||||||
|
|
||||||
lvl_array = dm_pool_alloc(lv->vg->vgmem,
|
if (!(lvl_array = dm_pool_alloc(lv->vg->vgmem,
|
||||||
sizeof(*lvl_array) * count * 2);
|
sizeof(*lvl_array) * count * 2)))
|
||||||
if (!lvl_array)
|
|
||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
if (!(parallel_areas = build_parallel_areas_from_lv(lv, 0, 1)))
|
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)))
|
lv->alloc, 0, parallel_areas)))
|
||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
for (s = 0; s < count; s++) {
|
for (s = 0; s < count; ++s) {
|
||||||
/*
|
/*
|
||||||
* The allocation areas are grouped together. First
|
* The allocation areas are grouped together. First
|
||||||
* come the rimage allocated areas, then come the metadata
|
* 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;
|
lvl_array[s].lv = tmp_lv;
|
||||||
dm_list_add(new_data_lvs, &(lvl_array[s].list));
|
dm_list_add(new_data_lvs, &(lvl_array[s].list));
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc_destroy(ah);
|
alloc_destroy(ah);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -523,6 +519,7 @@ static int _alloc_rmeta_for_lv(struct logical_volume *data_lv,
|
|||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
alloc_destroy(ah);
|
alloc_destroy(ah);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -736,13 +733,14 @@ to be left for these sub-lvs.
|
|||||||
|
|
||||||
fail:
|
fail:
|
||||||
/* Cleanly remove newly-allocated LVs that failed insertion attempt */
|
/* Cleanly remove newly-allocated LVs that failed insertion attempt */
|
||||||
|
|
||||||
dm_list_iterate_items(lvl, &meta_lvs)
|
dm_list_iterate_items(lvl, &meta_lvs)
|
||||||
if (!lv_remove(lvl->lv))
|
if (!lv_remove(lvl->lv))
|
||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
dm_list_iterate_items(lvl, &data_lvs)
|
dm_list_iterate_items(lvl, &data_lvs)
|
||||||
if (!lv_remove(lvl->lv))
|
if (!lv_remove(lvl->lv))
|
||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -841,9 +839,8 @@ static int _raid_extract_images(struct logical_volume *lv, uint32_t new_count,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
lvl_array = dm_pool_alloc(lv->vg->vgmem,
|
if (!(lvl_array = dm_pool_alloc(lv->vg->vgmem,
|
||||||
sizeof(*lvl_array) * extract * 2);
|
sizeof(*lvl_array) * extract * 2)))
|
||||||
if (!lvl_array)
|
|
||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
if (!(error_segtype = get_segtype_from_string(lv->vg->cmd, "error")))
|
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",
|
"while tracking changes for %s",
|
||||||
lv->name, tracking->name);
|
lv->name, tracking->name);
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
/* Ensure we only split the tracking image */
|
/* Ensure we only split the tracking image */
|
||||||
dm_list_init(&tracking_pvs);
|
dm_list_init(&tracking_pvs);
|
||||||
splittable_pvs = &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))
|
tracking, splittable_pvs))
|
||||||
return_0;
|
return_0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!_raid_extract_images(lv, new_count, splittable_pvs, 1,
|
if (!_raid_extract_images(lv, new_count, splittable_pvs, 1,
|
||||||
&removal_list, &data_list)) {
|
&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))
|
if (!activate_lv_excl_local(cmd, lvl->lv))
|
||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
dm_list_iterate_items(lvl, &removal_list)
|
dm_list_iterate_items(lvl, &removal_list)
|
||||||
if (!activate_lv_excl_local(cmd, lvl->lv))
|
if (!activate_lv_excl_local(cmd, lvl->lv))
|
||||||
return_0;
|
return_0;
|
||||||
@ -1217,7 +1215,7 @@ int lv_raid_split_and_track(struct logical_volume *lv,
|
|||||||
return 0;
|
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))
|
if (!lv_is_on_pvs(seg_lv(seg, s), splittable_pvs))
|
||||||
continue;
|
continue;
|
||||||
lv_set_visible(seg_lv(seg, s));
|
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);
|
vg->name, image_lv->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
lv = lvl->lv;
|
lv = lvl->lv;
|
||||||
seg = first_seg(lv);
|
seg = first_seg(lv);
|
||||||
for (s = 0; s < seg->area_count; s++) {
|
for (s = 0; s < seg->area_count; ++s)
|
||||||
if (seg_lv(seg, s) == image_lv) {
|
if (seg_lv(seg, s) == image_lv)
|
||||||
meta_lv = seg_metalv(seg, s);
|
meta_lv = seg_metalv(seg, s);
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!meta_lv)
|
if (!meta_lv)
|
||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
@ -1327,10 +1325,9 @@ static int _convert_mirror_to_raid1(struct logical_volume *lv,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
meta_areas = dm_pool_zalloc(lv->vg->vgmem,
|
if (!(meta_areas = dm_pool_zalloc(lv->vg->vgmem,
|
||||||
lv_mirror_count(lv) * sizeof(*meta_areas));
|
lv_mirror_count(lv) * sizeof(*meta_areas)))) {
|
||||||
if (!meta_areas) {
|
log_error("Failed to allocate meta areas memory.");
|
||||||
log_error("Failed to allocate memory");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1836,7 +1833,7 @@ static int _partial_raid_lv_is_redundant(struct logical_volume *lv)
|
|||||||
rebuilds_per_group++;
|
rebuilds_per_group++;
|
||||||
|
|
||||||
if (rebuilds_per_group >= copies) {
|
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));
|
display_lvname(lv));
|
||||||
return 0; /* Insufficient redundancy to activate */
|
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) {
|
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));
|
display_lvname(lv));
|
||||||
return 0; /* Insufficient redundancy to activate */
|
return 0; /* Insufficient redundancy to activate */
|
||||||
} else if (raid_seg->segtype->parity_devs &&
|
} else if (raid_seg->segtype->parity_devs &&
|
||||||
(failed_components > 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->parity_devs,
|
||||||
raid_seg->segtype->ops->name(raid_seg),
|
raid_seg->segtype->ops->name(raid_seg),
|
||||||
display_lvname(lv));
|
display_lvname(lv));
|
||||||
|
Loading…
Reference in New Issue
Block a user