Skip to contentSkip to conversation

master - Add and track an "ondisk" pointer to struct volume_group.

PATCH Petr Rockai 1 participant 1 message Jun 10, 2013

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5d5f2306bd4635cdc7e97a6a875384a00c9be460
Commit:        5d5f2306bd4635cdc7e97a6a875384a00c9be460
Parent:        c1e851e2084cbb09ed28199bc332aa3b1e99bbae
Author:        Petr Rockai <[email protected]>
AuthorDate:    Sun Mar 17 16:27:44 2013 +0100
Committer:     Petr Rockai <[email protected]>
CommitterDate: Mon Jun 10 17:26:29 2013 +0200

Add and track an "ondisk" pointer to struct volume_group.

This allows us to get the current on-disk version of the metadata whenever we have the current in-flight version, without a recourse to scanning or lvmcache.

---
 lib/metadata/lv.h       |    1 +
 lib/metadata/metadata.c |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 lib/metadata/vg.c       |    1 +
 lib/metadata/vg.h       |    9 +++++++++
 4 files changed, 58 insertions(+), 0 deletions(-)
lib/metadata/lv.h +1 -0
index 8e771a1..b1cce51 100644
@@ -90,4 +90,5 @@ int lv_active_change(struct cmd_context *cmd, struct logical_volume *lv,
 		     enum activation_change activate);
 char *lv_active_dup(struct dm_pool *mem, const struct logical_volume *lv);
 const struct logical_volume *lv_lock_holder(const struct logical_volume *lv);
+struct logical_volume *lv_ondisk(struct logical_volume *lv);
 #endif /* _LVM_LV_H */
lib/metadata/metadata.c +47 -0

74 lines not on this page · raw message

lib/metadata/vg.c +1 -0
index a868df7..50e8328 100644
@@ -87,6 +87,7 @@ void release_vg(struct volume_group *vg)
 	    !lvmcache_vginfo_holders_dec_and_test_for_zero(vg->vginfo))
 		return;
 
+	release_vg(vg->vg_ondisk);
 	_free_vg(vg);
 }
 
lib/metadata/vg.h +9 -0
index f876968..0dc3ba7 100644
@@ -48,6 +48,15 @@ struct volume_group {
 	uint32_t cmd_missing_vgs;/* Flag marks missing VG */
 	uint32_t seqno;		/* Metadata sequence number */
 
+	/*
+	 * The parsed on-disk copy of this VG; is NULL if this is the on-disk
+	 * version (i.e. vg_ondisk == NULL *implies* this is the on-disk copy,
+	 * there is no guarantee that if this VG is the same as the on-disk one
+	 * this will be NULL). The pointer is maintained by calls to
+	 * _vg_update_vg_ondisk.
+	 */
+	struct volume_group *vg_ondisk;
+
 	alloc_policy_t alloc;
 	uint64_t status;