]> sourceware.org Git - lvm2.git/commitdiff
cache: fix lvdisplay output
authorZdenek Kabelac <zkabelac@redhat.com>
Thu, 22 Jun 2017 18:05:26 +0000 (20:05 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Thu, 22 Jun 2017 18:17:18 +0000 (20:17 +0200)
Unused cache pool may have lots of fields actually undefined,
so avoid printing them, if they are not specified in metadata.

WHATS_NEW
lib/cache_segtype/cache.c

index 12368dd679a5ba9b63575380d49f787e204e901a..f1f354d20f4241b7432af7ece09ddb4cca07d8ec 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.02.172 - 
 ===============================
+  Do not lvdisplay --maps unset settings of cache pool.
   Fix lvdisplay --maps for cache pool without policy settings.
   Avoid using origin_only manipulation with cached device.
   Support aborting of flushing cache LV.
index 7461b21f5ea0e158cab8dfc5eb7a2a4a6c628df0..26f3e3268eab02903a253c0f7291b40fa6161377 100644 (file)
@@ -51,9 +51,15 @@ static void _cache_display(const struct lv_segment *seg)
 
        log_print("  Chunk size\t\t%s",
                  display_size(seg->lv->vg->cmd, pool_seg->chunk_size));
-       log_print("  Metadata format\t%u", pool_seg->cache_metadata_format);
-       log_print("  Mode\t\t%s", get_cache_mode_name(pool_seg));
-       log_print("  Policy\t\t%s", pool_seg->policy_name);
+
+       if (pool_seg->cache_metadata_format != CACHE_METADATA_FORMAT_UNSELECTED)
+               log_print("  Metadata format\t%u", pool_seg->cache_metadata_format);
+
+       if (pool_seg->cache_mode != CACHE_MODE_UNSELECTED)
+               log_print("  Mode\t\t%s", get_cache_mode_name(pool_seg));
+
+       if (pool_seg->policy_name)
+               log_print("  Policy\t\t%s", pool_seg->policy_name);
 
        if (pool_seg->policy_settings &&
            (n = pool_seg->policy_settings->child))
This page took 0.040703 seconds and 5 git commands to generate.