From baee45a103846a995b847e04c1c2985bfd1743e0 Mon Sep 17 00:00:00 2001 From: Peter Rajnoha Date: Tue, 1 Mar 2016 15:22:36 +0100 Subject: [PATCH] metadata: add lv_is_historical fn to test if the LV is historical one --- lib/metadata/lv.c | 5 +++++ lib/metadata/metadata-exported.h | 2 ++ lib/metadata/snapshot_manip.c | 3 +++ 3 files changed, 10 insertions(+) diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c index 459de6e79..a5144e9a4 100644 --- a/lib/metadata/lv.c +++ b/lib/metadata/lv.c @@ -28,6 +28,11 @@ static struct utsname _utsname; static int _utsinit = 0; +int lv_is_historical(const struct logical_volume *lv) +{ + return lv->this_glv && lv->this_glv->is_historical; +} + static struct dm_list *_format_pvsegs(struct dm_pool *mem, const struct lv_segment *seg, int range_format, int metadata_areas_only, int mark_hidden) diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h index afd472373..b8699f7aa 100644 --- a/lib/metadata/metadata-exported.h +++ b/lib/metadata/metadata-exported.h @@ -1066,6 +1066,8 @@ int lv_is_cow_covering_origin(const struct logical_volume *lv); /* Test if given LV is visible from user's perspective */ int lv_is_visible(const struct logical_volume *lv); +int lv_is_historical(const struct logical_volume *lv); + int pv_is_in_vg(struct volume_group *vg, struct physical_volume *pv); /* Given a cow or thin LV, return the snapshot lv_segment that uses it */ diff --git a/lib/metadata/snapshot_manip.c b/lib/metadata/snapshot_manip.c index 5fef0019d..e8a4dc5b3 100644 --- a/lib/metadata/snapshot_manip.c +++ b/lib/metadata/snapshot_manip.c @@ -113,6 +113,9 @@ int lv_is_cow_covering_origin(const struct logical_volume *lv) int lv_is_visible(const struct logical_volume *lv) { + if (lv_is_historical(lv)) + return 1; + if (lv->status & SNAPSHOT) return 0; -- 2.43.5