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

snapshot: improve removal of active origin volume

Previously when lvremove tried to remove 'active' origin,
it had been asking for every 'snapshot' LV separately
and doing individual single snapshot removals first.

To be faster it now deactivates origin before removal
all connected snapshots.

This avoids multiple reloads of dm table for origin volume
which were unnecessary as origin was meant to be removed as well.
This commit is contained in:
Zdenek Kabelac 2017-02-22 15:12:54 +01:00
parent 6716f5a2f4
commit 9712995edd
2 changed files with 14 additions and 4 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.169 - Version 2.02.169 -
===================================== =====================================
Deactivate active origin first before removal for improved workflow.
Fix regression of accepting options --type and -m with lvresize (2.02.158). Fix regression of accepting options --type and -m with lvresize (2.02.158).
Add lvconvert --swapmetadata, new specific way to swap pool metadata LVs. Add lvconvert --swapmetadata, new specific way to swap pool metadata LVs.
Add lvconvert --startpoll, new specific way to start polling conversions. Add lvconvert --startpoll, new specific way to start polling conversions.

View File

@ -6229,12 +6229,21 @@ int lv_remove_with_dependencies(struct cmd_context *cmd, struct logical_volume *
/* Remove snapshot LVs first */ /* Remove snapshot LVs first */
if ((force == PROMPT) && if ((force == PROMPT) &&
/* Active snapshot already needs to confirm each active LV */ /* Active snapshot already needs to confirm each active LV */
!lv_is_active(lv) && (yes_no_prompt("Do you really want to remove%s "
yes_no_prompt("Removing origin %s will also remove %u " "%sorigin logical volume %s with %u snapshot(s)? [y/n]: ",
"snapshots(s). Proceed? [y/n]: ", lv_is_active(lv) ? " active" : "",
lv->name, lv->origin_count) == 'n') vg_is_clustered(lv->vg) ? "clustered " : "",
display_lvname(lv),
lv->origin_count) == 'n'))
goto no_remove; goto no_remove;
if (!deactivate_lv(cmd, lv)) {
stack;
goto no_remove;
}
log_verbose("Removing origin logical volume %s with %u snapshots(s).",
display_lvname(lv), lv->origin_count);
dm_list_iterate_safe(snh, snht, &lv->snapshot_segs) dm_list_iterate_safe(snh, snht, &lv->snapshot_segs)
if (!lv_remove_with_dependencies(cmd, dm_list_struct_base(snh, struct lv_segment, if (!lv_remove_with_dependencies(cmd, dm_list_struct_base(snh, struct lv_segment,
origin_list)->cow, origin_list)->cow,