Skip to contentSkip to conversation

master - lvmcache: rename suspended_vg to saved_vg

PATCH David Teigland 1 participant 1 message Apr 25, 2018

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f8616ac2d87b247dd9ae041d59e6dbe43c88172c
Commit:        f8616ac2d87b247dd9ae041d59e6dbe43c88172c
Parent:        28a9fcd94b810cbd603b4fb0c5149bf96f6caeaa
Author:        David Teigland <[email protected]>
AuthorDate:    Tue Apr 24 12:18:22 2018 -0500
Committer:     David Teigland <[email protected]>
CommitterDate: Wed Apr 25 16:39:43 2018 -0500

lvmcache: rename suspended_vg to saved_vg

The copy of the VG which clvmd stashes in lvmcache should not only be used between suspend and resume, but between sequential LV operations in clvmd, so that clvmd does not need to reread the VG for each one. Prepare for that by renaming the stashed VG as "saved_vg".

---
 lib/activate/activate.c |   12 ++--
 lib/cache/lvmcache.c    |  127 +++++++++++++++++++++++------------------------
 lib/cache/lvmcache.h    |    6 +-
 3 files changed, 72 insertions(+), 73 deletions(-)
lib/activate/activate.c +6 -6
index 565e643..9211714 100644
@@ -2181,8 +2181,8 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
 	 * did happen (or failed), and it will resume LVs using the
 	 * new/precommitted metadata if the vg_commit succeeded.
 	 */
-	lvmcache_save_suspended_vg(lv->vg, 0);
-	lvmcache_save_suspended_vg(lv_pre->vg, 1);
+	lvmcache_save_vg(lv->vg, 0);
+	lvmcache_save_vg(lv_pre->vg, 1);
 
 	if (!info.exists || info.suspended) {
 		if (!error_if_not_suspended) {
@@ -2405,16 +2405,16 @@ static int _lv_resume(struct cmd_context *cmd, const char *lvid_s,
 	 * When called in clvmd, lvid_s is set and lv is not.  We need to
 	 * get the VG metadata without reading disks because devs are
 	 * suspended.  lv_suspend() saved old and new VG metadata for us
-	 * to use here.  If vg_commit() happened, lvmcache_get_suspended_vg
+	 * to use here.  If vg_commit() happened, lvmcache_get_saved_vg
 	 * will return the new metadata for us to use in resuming LVs.
-	 * If vg_commit() did not happen, lvmcache_get_suspended_vg
+	 * If vg_commit() did not happen, lvmcache_get_saved_vg
 	 * returns the old metadata which we use to resume LVs.
 	 */
 	if (!lv && lvid_s) {
 		lvid = (const union lvid *) lvid_s;
 		vgid = (const char *)lvid->id[0].uuid;
 
-		if ((vg = lvmcache_get_suspended_vg(vgid))) {
+		if ((vg = lvmcache_get_saved_vg(vgid))) {
 			log_debug_activation("Resuming LVID %s found saved vg seqno %d %s", lvid_s, vg->seqno, vg->name);
 			if ((lv_found = find_lv_in_vg_by_lvid(vg, lvid))) {
 				log_debug_activation("Resuming LVID %s found saved LV %s", lvid_s, display_lvname(lv_found));
@@ -2655,7 +2655,7 @@ int lv_activation_filter(struct cmd_context *cmd, const char *lvid_s,
 		lvid = (const union lvid *) lvid_s;
 		vgid = (const char *)lvid->id[0].uuid;
 
-		if ((vg = lvmcache_get_suspended_vg(vgid))) {
+		if ((vg = lvmcache_get_saved_vg(vgid))) {
 			log_debug_activation("activation_filter for %s found saved VG seqno %d %s", lvid_s, vg->seqno, vg->name);
 			if ((lv_found = find_lv_in_vg_by_lvid(vg, lvid))) {
 				log_debug_activation("activation_filter for %s found saved LV %s", lvid_s, display_lvname(lv_found));
lib/cache/lvmcache.c +61 -62

216 lines not on this page · raw message

lib/cache/lvmcache.h +3 -3
index ad478bd..b62d589 100644
@@ -213,9 +213,9 @@ int lvmcache_get_vg_devs(struct cmd_context *cmd,
 			 struct dm_list *devs);
 void lvmcache_set_independent_location(const char *vgname);
 
-void lvmcache_save_suspended_vg(struct volume_group *vg, int precommitted);
-struct volume_group *lvmcache_get_suspended_vg(const char *vgid);
-void lvmcache_drop_suspended_vg(struct volume_group *vg);
+void lvmcache_save_vg(struct volume_group *vg, int precommitted);
+struct volume_group *lvmcache_get_saved_vg(const char *vgid);
+void lvmcache_drop_saved_vg(struct volume_group *vg);
 
 int lvmcache_scan_mismatch(struct cmd_context *cmd, const char *vgname, const char *vgid);