mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +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:
parent
e992cb253c
commit
77952151af
@ -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).
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user