Skip to contentSkip to conversation

master - activate_lvs: use exclusive activation

PATCH Zdenek Kabelac 1 participant 1 message Nov 15, 2017

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=838592a17119814adc5564569ef431fb0000c639
Commit:        838592a17119814adc5564569ef431fb0000c639
Parent:        8212e1047e2f42f4e13e2aadec5cf73b8d3a082e
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Tue Nov 14 11:46:43 2017 +0100
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Wed Nov 15 14:03:22 2017 +0100

activate_lvs: use exclusive activation

There is no need to differentiation between clustered VG and normal VG. As the activation depends on locking type.

Use unconditionally locally exclusive activation for pvmove.

---
 lib/locking/locking.c |   11 +---
 lib/locking/locking.h |    2 +-
 tools/pvmove.c        |  119 ++++++++----------------------------------------
 3 files changed, 24 insertions(+), 108 deletions(-)
lib/locking/locking.c +3 -8
index 067cd69..0426744 100644
@@ -460,19 +460,14 @@ int activate_lv_excl(struct cmd_context *cmd, const struct logical_volume *lv)
 }
 
 /* Lock a list of LVs */
-int activate_lvs(struct cmd_context *cmd, struct dm_list *lvs, unsigned exclusive)
+int activate_lvs(struct cmd_context *cmd, struct dm_list *lvs)
 {
 	struct dm_list *lvh;
 	struct lv_list *lvl;
 
 	dm_list_iterate_items(lvl, lvs) {
-		if (!exclusive && !lv_is_active_exclusive(lvl->lv)) {
-			if (!activate_lv(cmd, lvl->lv)) {
-				log_error("Failed to activate %s", lvl->lv->name);
-				return 0;
-			}
-		} else if (!activate_lv_excl(cmd, lvl->lv)) {
-			log_error("Failed to activate %s", lvl->lv->name);
+		if (!activate_lv_excl_local(cmd, lvl->lv)) {
+			log_error("Failed to activate %s", display_lvname(lvl->lv));
 			dm_list_uniterate(lvh, lvs, &lvl->list) {
 				lvl = dm_list_item(lvh, struct lv_list);
 				if (!deactivate_lv(cmd, lvl->lv))
lib/locking/locking.h +1 -1
index d39a725..4b5490e 100644
@@ -266,6 +266,6 @@ int suspend_lvs(struct cmd_context *cmd, struct dm_list *lvs,
 		struct volume_group *vg_to_revert);
 int resume_lvs(struct cmd_context *cmd, struct dm_list *lvs);
 int revert_lvs(struct cmd_context *cmd, struct dm_list *lvs);
-int activate_lvs(struct cmd_context *cmd, struct dm_list *lvs, unsigned exclusive);
+int activate_lvs(struct cmd_context *cmd, struct dm_list *lvs);
 
 #endif
tools/pvmove.c +20 -99

193 lines not on this page · raw message