Skip to contentSkip to conversation

master - writecache: move code into new file

PATCH David Teigland 1 participant 1 message Sep 24, 2019 Library code

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=76dd9b2b518e85a4fecbc752424a8a0f36616838
Commit:        76dd9b2b518e85a4fecbc752424a8a0f36616838
Parent:        56aadd7fe2a1d24043ea9d06543c29317ac1cc58
Author:        David Teigland <[email protected]>
AuthorDate:    Tue Sep 24 15:28:02 2019 -0500
Committer:     David Teigland <[email protected]>
CommitterDate: Tue Sep 24 15:51:05 2019 -0500

writecache: move code into new file

put writecache specific code in writecache_manip.c

should be no functional change

---
 lib/Makefile.in                  |    1 +
 lib/metadata/metadata-exported.h |    1 +
 lib/metadata/metadata.c          |   27 -----
 lib/metadata/writecache_manip.c  |  201 ++++++++++++++++++++++++++++++++++++++
 tools/lvconvert.c                |  142 +--------------------------
 5 files changed, 208 insertions(+), 164 deletions(-)
lib/Makefile.in +1 -0
index 654c322..c037b41 100644
@@ -66,6 +66,7 @@ SOURCES =\
 	locking/locking.c \
 	log/log.c \
 	metadata/cache_manip.c \
+	metadata/writecache_manip.c \
 	metadata/lv.c \
 	metadata/lv_manip.c \
 	metadata/merge.c \
lib/metadata/metadata-exported.h +1 -0
index 7c9aebb..ea8635e 100644
@@ -1282,6 +1282,7 @@ struct logical_volume *lv_cache_create(struct logical_volume *pool_lv,
 int lv_cache_wait_for_clean(struct logical_volume *cache_lv, int *is_clean);
 int lv_cache_remove(struct logical_volume *cache_lv);
 int lv_detach_cache_vol(struct logical_volume *cache_lv, int noflush);
+int lv_detach_writecache_cachevol(struct logical_volume *cache_lv, int noflush);
 int wipe_cache_pool(struct logical_volume *cache_pool_lv);
 /* --  metadata/cache_manip.c */
 
lib/metadata/metadata.c +0 -27
index 644cd59..b434967 100644
@@ -5166,30 +5166,3 @@ struct volume_group *vg_read_for_update(struct cmd_context *cmd, const char *vg_
 
 	return vg;
 }
-
-int lv_is_writecache_origin(const struct logical_volume *lv)
-{
-	struct seg_list *sl;
-
-	dm_list_iterate_items(sl, &lv->segs_using_this_lv) {
-		if (!sl->seg || !sl->seg->lv || !sl->seg->origin)
-			continue;
-		if (lv_is_writecache(sl->seg->lv) && (sl->seg->origin == lv))
-			return 1;
-	}
-	return 0;
-}
-
-int lv_is_writecache_cachevol(const struct logical_volume *lv)
-{
-	struct seg_list *sl;
-
-	dm_list_iterate_items(sl, &lv->segs_using_this_lv) {
-		if (!sl->seg || !sl->seg->lv || !sl->seg->writecache)
-			continue;
-		if (lv_is_writecache(sl->seg->lv) && (sl->seg->writecache == lv))
-			return 1;
-	}
-	return 0;
-}
-
lib/metadata/writecache_manip.c new file +201 -0

201 lines not on this page · raw message

tools/lvconvert.c +5 -137

160 lines not on this page · raw message