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

lvremove: support faster removal of thin-pools

When lvremove/vgremove removes thin volumes with its thin-pool as well,
try to skip any updates of such thin-pool, so when everything properly
deactivates, there is no message send to this thin-pool and whole
thin-pool is removed with a single commit.
This commit is contained in:
Zdenek Kabelac 2021-03-10 23:19:25 +01:00
parent dac8274701
commit f4543aca15
2 changed files with 9 additions and 0 deletions

View File

@ -57,6 +57,7 @@ struct logical_volume {
uint64_t timestamp;
unsigned new_lock_args:1;
unsigned to_remove:1; /* set when LV is known to be removed */
const char *hostname;
const char *lock_args;
};

View File

@ -6589,6 +6589,9 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
return 0;
}
lock_lv = pool_lv;
if (pool_lv->to_remove)
/* Thin pool is to be removed so skip updating it when possible */
pool_lv = NULL;
}
if (lv_is_locked(lv)) {
@ -6823,6 +6826,11 @@ static int _lv_remove_segs_using_this_lv(struct cmd_context *cmd, struct logical
log_error("Logical volume \"%s\" not removed.", lv->name);
return 0;
}
/* Make aware users of this LV, it's going to be removed, so they
* can skip any updates of itself */
lv->to_remove = 1;
/*
* Not using _safe iterator here - since we may delete whole subtree
* (similar as process_each_lv_in_vg())