summaryrefslogtreecommitdiff
path: root/tools/reporter.c
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2016-09-09 14:24:49 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2016-09-09 15:01:35 +0200
commit4b22cd81e6b3b60f08976df4104b7411d1af4fc5 (patch)
treef7b1aafc9944996b8c33256bc4332fb3a6daf691 /tools/reporter.c
parenta13440d7ca4268eeede9986223d31e33122e753a (diff)
downloadlvm2-4b22cd81e6b3b60f08976df4104b7411d1af4fc5.tar.gz
cache: report metadata percentage
Reinstantiate reporting of metadata percent usage for cache volumes. Also show the same percentage with hidden cache-pool LV. This regression was caused by optimization for a single-ioctl in 2.02.155.
Diffstat (limited to 'tools/reporter.c')
-rw-r--r--tools/reporter.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/reporter.c b/tools/reporter.c
index 0df22ff3c..b7a2f39b5 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -89,6 +89,12 @@ static int _vgs_single(struct cmd_context *cmd __attribute__((unused)),
static void _choose_lv_segment_for_status_report(const struct logical_volume *lv, const struct lv_segment **lv_seg)
{
+ if (lv_is_used_cache_pool(lv)) {
+ /* For a used cache pool, choose cache volume segment */
+ *lv_seg = get_only_segment_using_this_lv(lv);
+ return;
+ }
+
/*
* By default, take the first LV segment to report status for.
* If there's any other specific segment that needs to be
@@ -115,8 +121,9 @@ static int _do_info_and_status(struct cmd_context *cmd,
if (do_status) {
if (!(status->seg_status.mem = dm_pool_create("reporter_pool", 1024)))
return_0;
- if (!lv_seg)
+ if (!lv_seg || seg_is_used_cache_pool(lv_seg))
_choose_lv_segment_for_status_report(lv, &lv_seg);
+
if (do_info) {
/* both info and status */
status->info_ok = lv_info_with_seg_status(cmd, lv, lv_seg, use_layer, status, 1, 1);
@@ -124,6 +131,11 @@ static int _do_info_and_status(struct cmd_context *cmd,
if (use_layer && status->info_ok &&
!lv_info(cmd, lv, 0, NULL, 0, 0))
memset(&status->info, 0, sizeof(status->info));
+ /* for inactive cache reset lvinfo for its struct for cache-pool */
+ if (lv_is_used_cache_pool(lv) && !status->info_ok) {
+ memset(&status->info, 0, sizeof(status->info));
+ status->info_ok = 1;
+ }
} else
/* status only */
status->info_ok = lv_status(cmd, lv_seg, use_layer, &status->seg_status);