1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

cache: call status only on cache pool in use

Check show cache status only for cache pool in use.
This commit is contained in:
Zdenek Kabelac 2016-05-24 15:19:01 +02:00
parent a4f8d1165c
commit 0424277c00
4 changed files with 7 additions and 5 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.155 -
================================
Check cache status only for 'in-use' cache pools.
Extend setup_task() to preset flushing for dm_task object.
When checking LV is a merging COW, validate its a COW LV first.
Correcting value in copy_percent() for 100%.

View File

@ -230,6 +230,7 @@
#define lv_is_cache(lv) (((lv)->status & CACHE) ? 1 : 0)
#define lv_is_cache_pool(lv) (((lv)->status & CACHE_POOL) ? 1 : 0)
#define lv_is_used_cache_pool(lv) (lv_is_cache_pool(lv) && !dm_list_empty(&(lv)->segs_using_this_lv))
#define lv_is_cache_pool_data(lv) (((lv)->status & CACHE_POOL_DATA) ? 1 : 0)
#define lv_is_cache_pool_metadata(lv) (((lv)->status & CACHE_POOL_METADATA) ? 1 : 0)
#define lv_is_cache_type(lv) (((lv)->status & (CACHE | CACHE_POOL | CACHE_POOL_DATA | CACHE_POOL_METADATA)) ? 1 : 0)

View File

@ -109,7 +109,7 @@ static dm_percent_t _data_percent(const struct logical_volume *lv)
if (lv_is_cow(lv))
return _snap_percent(lv);
if (lv_is_cache(lv) || lv_is_cache_pool(lv)) {
if (lv_is_cache(lv) || lv_is_used_cache_pool(lv)) {
if (!lv_cache_status(lv, &status)) {
stack;
return DM_PERCENT_INVALID;
@ -130,7 +130,7 @@ static dm_percent_t _metadata_percent(const struct logical_volume *lv)
dm_percent_t percent;
struct lv_status_cache *status;
if (lv_is_cache(lv) || lv_is_cache_pool(lv)) {
if (lv_is_cache(lv) || lv_is_used_cache_pool(lv)) {
if (!lv_cache_status(lv, &status)) {
stack;
return DM_PERCENT_INVALID;

View File

@ -2849,7 +2849,7 @@ static int _copypercent_disp(struct dm_report *rh,
(lv_is_mirror(lv) && lv_mirror_percent(lv->vg->cmd, lv, 0, &percent, NULL))) &&
(percent != DM_PERCENT_INVALID)) {
percent = copy_percent(lv);
} else if (lv_is_cache(lv) || lv_is_cache_pool(lv)) {
} else if (lv_is_cache(lv) || lv_is_used_cache_pool(lv)) {
if (lv_cache_status(lv, &status)) {
percent = status->dirty_usage;
dm_pool_destroy(status->mem);
@ -2947,7 +2947,7 @@ static int _datapercent_disp(struct dm_report *rh, struct dm_pool *mem,
(void) lv_thin_pool_percent(lv, 0, &percent);
else if (lv_is_thin_volume(lv))
(void) lv_thin_percent(lv, 0, &percent);
else if (lv_is_cache(lv) || lv_is_cache_pool(lv)) {
else if (lv_is_cache(lv) || lv_is_used_cache_pool(lv)) {
if (lv_cache_status(lv, &status)) {
percent = status->data_usage;
dm_pool_destroy(status->mem);
@ -2970,7 +2970,7 @@ static int _metadatapercent_disp(struct dm_report *rh,
(void) lv_thin_pool_percent(lv, 1, &percent);
else if (lv_is_thin_volume(lv))
(void) lv_thin_percent(lv, 1, &percent);
else if (lv_is_cache(lv) || lv_is_cache_pool(lv)) {
else if (lv_is_cache(lv) || lv_is_used_cache_pool(lv)) {
if (lv_cache_status(lv, &status)) {
percent = status->metadata_usage;
dm_pool_destroy(status->mem);