summaryrefslogtreecommitdiff
path: root/lib/metadata/lv_manip.c
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2021-03-10 23:19:25 +0100
committerZdenek Kabelac <zkabelac@redhat.com>2021-03-11 00:18:01 +0100
commitf4543aca15743eafdc03b4ad92084ef7343f904d (patch)
tree46b38b553683a14d587d83902a5ab4bcae798169 /lib/metadata/lv_manip.c
parentdac827470195f46393522b20ef5678136f72126b (diff)
downloadlvm2-f4543aca15743eafdc03b4ad92084ef7343f904d.tar.gz
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.
Diffstat (limited to 'lib/metadata/lv_manip.c')
-rw-r--r--lib/metadata/lv_manip.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 74a34c9cd..4114e7d5c 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -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())