1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

lvremove: backup at the end of loop

Taking backup with each removed LV is slowing down the process
considerable and is largerly uneeded. We are supposed to take
backup only on significant points and making sure the backup
is correct when the command is finished.

TODO: check how many other commands can be improved.
This commit is contained in:
Zdenek Kabelac 2021-02-26 01:01:29 +01:00
parent fa64c51428
commit eb1160ee42
4 changed files with 7 additions and 1 deletions

View File

@ -267,6 +267,8 @@ int backup_locally(struct volume_group *vg)
int backup(struct volume_group *vg)
{
vg->needs_backup = 0;
/* Unlock memory if possible */
memlock_unlock(vg->cmd);

View File

@ -6780,7 +6780,7 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
display_lvname(pool_lv));
}
backup(vg);
vg->needs_backup = 1;
lockd_lv(cmd, lock_lv, "un", LDLV_PERSISTENT);
lockd_free_lv(cmd, vg, lv->name, &lv->lvid.id[1], lv->lock_args);

View File

@ -42,6 +42,7 @@ struct volume_group {
struct lvmcache_vginfo *vginfo;
uint32_t seqno; /* Metadata sequence number */
unsigned skip_validate_lock_args : 1;
unsigned needs_backup : 1;
uint32_t write_count; /* count the number of vg_write calls */
/*

View File

@ -3214,6 +3214,9 @@ int process_each_lv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
log_set_report_object_name_and_id(NULL, NULL);
}
if (vg->needs_backup)
backup(vg);
if (lvargs_supplied) {
/*
* FIXME: lvm supports removal of LV with all its dependencies