dev-mornfall-lvmcache - snapshot: add lv_is_cow_covering_origin
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=77952151af683eda4210cbfe4f9928f736ee92a9 Commit: 77952151af683eda4210cbfe4f9928f736ee92a9 Parent: e992cb253cb4c9bf027dd7852d4399d2b439621c Author: Zdenek Kabelac <[email protected]> AuthorDate: Mon May 27 10:18:20 2013 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Mon May 27 10:34:53 2013 +0200
snapshot: add lv_is_cow_covering_origin
Add function to check is size of cow is already big enough to cover whole origin.
--- WHATS_NEW | 1 + lib/metadata/metadata-exported.h | 1 + lib/metadata/snapshot_manip.c | 7 +++++++ 3 files changed, 9 insertions(+), 0 deletions(-)
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.02.99 - =================================== + Add lv_is_cow_covering_origin() to check if cow covers origin size. Use libdm dm_get_status_snapshot() to parse snapshot status. Add detection of mounted fs also for vgchange deactivation. Replace 'lv_is_active' with more correct/specific variants (e.g. *_locally).
lib/metadata/metadata-exported.h +1 -0
@@ -717,6 +717,7 @@ int lv_is_virtual_origin(const struct logical_volume *lv);int lv_is_cow (const struct logical_volume *lv);int lv_is_merging_origin (const struct logical_volume *origin);int lv_is_merging_cow (const struct logical_volume *snapshot); +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);
lib/metadata/snapshot_manip.c +7 -0
@@ -31,6 +31,13 @@ int lv_is_cow(const struct logical_volume *lv)return (!lv_is_origin (lv) && lv->snapshot) ?1 :0 ; } +int lv_is_cow_covering_origin (const struct logical_volume *lv) +{ +/* TODO: we need less then 1% of origin size, depends on chunk size */ +return lv_is_cow (lv) ? + (origin_from_cow (lv)->size *UINT64_C (101 ) <= lv->size *UINT64_C (100 )) :0 ; +} +int lv_is_visible (const struct logical_volume *lv) {if (lv->status &SNAPSHOT )