summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2016-05-24 15:19:01 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2016-05-27 15:47:24 +0200
commit0424277c00a8c576082389e0f4cdd8fd64052a54 (patch)
tree3c36379e154dc27db8cc6e5c1bdcd7835493ff50
parenta4f8d1165cfed1a3d62b4b11fd46302fb7e9563c (diff)
downloadlvm2-0424277c00a8c576082389e0f4cdd8fd64052a54.tar.gz
cache: call status only on cache pool in use
Check show cache status only for cache pool in use.
-rw-r--r--WHATS_NEW1
-rw-r--r--lib/metadata/metadata-exported.h1
-rw-r--r--lib/report/properties.c4
-rw-r--r--lib/report/report.c6
4 files changed, 7 insertions, 5 deletions
diff --git a/WHATS_NEW b/WHATS_NEW
index 44be4100b..a6957bc87 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -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%.
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index a85049203..1a9d5d904 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -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)
diff --git a/lib/report/properties.c b/lib/report/properties.c
index 46f58bed9..d3feb07fe 100644
--- a/lib/report/properties.c
+++ b/lib/report/properties.c
@@ -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;
diff --git a/lib/report/report.c b/lib/report/report.c
index 8fa9daf75..fd084f165 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -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);