1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-27 01:55:10 +03:00

snapshot: add lv_is_cow_covering_origin

Add function to check is size of cow is already big enough
to cover whole origin.
This commit is contained in:
Zdenek Kabelac 2013-05-27 10:18:20 +02:00
parent e992cb253c
commit 77952151af
3 changed files with 9 additions and 0 deletions

View File

@ -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).

View File

@ -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);

View File

@ -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)