mirror of
git://sourceware.org/git/lvm2.git
synced 2025-08-30 05:49:28 +03:00
cleanup: Reduce indentation by short-circuiting function
By changing the conditional for resyncing mirrors with core-logs a bit, we can short-circuit the rest of the function for that case and reduce the amount of indenting in the rest of the function. This cleanup will simplify future patches aimed at properly handling the resync of RAID LVs.
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.98 -
|
Version 2.02.98 -
|
||||||
=================================
|
=================================
|
||||||
|
Disallow addition of RAID images until the array is in-sync.
|
||||||
Fix RAID LV creation with '--test' so valid commands do not fail.
|
Fix RAID LV creation with '--test' so valid commands do not fail.
|
||||||
Add lvm_lv_rename() to lvm2api.
|
Add lvm_lv_rename() to lvm2api.
|
||||||
Fix setvbuf code by closing and reopening stream before changing buffer.
|
Fix setvbuf code by closing and reopening stream before changing buffer.
|
||||||
|
@ -335,18 +335,31 @@ static int lvchange_resync(struct cmd_context *cmd,
|
|||||||
* it to reset the sync status. We only need to
|
* it to reset the sync status. We only need to
|
||||||
* worry about persistent logs.
|
* worry about persistent logs.
|
||||||
*/
|
*/
|
||||||
if (!log_lv && !(lv->status & LV_NOTSYNCED)) {
|
if (!log_lv) {
|
||||||
|
if (!(lv->status & LV_NOTSYNCED)) {
|
||||||
|
lv->status &= ~LV_NOTSYNCED;
|
||||||
|
log_very_verbose("Updating logical volume \"%s\""
|
||||||
|
" on disk(s)", lv->name);
|
||||||
|
if (!vg_write(lv->vg) || !vg_commit(lv->vg)) {
|
||||||
|
log_error("Failed to update metadata on disk.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (active && !activate_lv(cmd, lv)) {
|
if (active && !activate_lv(cmd, lv)) {
|
||||||
log_error("Failed to reactivate %s to resynchronize "
|
log_error("Failed to reactivate %s to resynchronize "
|
||||||
"mirror", lv->name);
|
"mirror", lv->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Now we handle mirrors with log devices
|
||||||
|
*/
|
||||||
lv->status &= ~LV_NOTSYNCED;
|
lv->status &= ~LV_NOTSYNCED;
|
||||||
|
|
||||||
if (log_lv) {
|
|
||||||
/* Separate mirror log so we can clear it */
|
/* Separate mirror log so we can clear it */
|
||||||
detach_mirror_log(first_seg(lv));
|
detach_mirror_log(first_seg(lv));
|
||||||
|
|
||||||
@ -394,7 +407,6 @@ static int lvchange_resync(struct cmd_context *cmd,
|
|||||||
/* Put mirror log back in place */
|
/* Put mirror log back in place */
|
||||||
if (!attach_mirror_log(first_seg(lv), log_lv))
|
if (!attach_mirror_log(first_seg(lv), log_lv))
|
||||||
stack;
|
stack;
|
||||||
}
|
|
||||||
|
|
||||||
log_very_verbose("Updating logical volume \"%s\" on disk(s)", lv->name);
|
log_very_verbose("Updating logical volume \"%s\" on disk(s)", lv->name);
|
||||||
if (!vg_write(lv->vg) || !vg_commit(lv->vg)) {
|
if (!vg_write(lv->vg) || !vg_commit(lv->vg)) {
|
||||||
|
Reference in New Issue
Block a user