From bac15c11983e72cfd8ce10512aa9d227135bbca0 Mon Sep 17 00:00:00 2001 From: Serapheim Dimitropoulos Date: Thu, 18 Jul 2019 12:54:03 -0700 Subject: zdb: don't print log spacemap stats in pools without the feature Creating a pool with not features enabled and running `zdb -mmmmmm on` it before the patch: ``` Log Space Maps in Pool: Log Space Map Obsolete Entry Statistics: 0 valid entries out of 0 - txg 0 0 valid entries out of 0 - total ``` After this patch the above output goes away. Reviewed by: Matt Ahrens Reviewed by: Sara Hartse Reviewed by: Brian Behlendorf Signed-off-by: Serapheim Dimitropoulos Closes #9048 --- cmd/zdb/zdb.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'cmd/zdb') diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c index 8ccbd5e8b..7e7e26448 100644 --- a/cmd/zdb/zdb.c +++ b/cmd/zdb/zdb.c @@ -1204,6 +1204,9 @@ dump_metaslabs(spa_t *spa) static void dump_log_spacemaps(spa_t *spa) { + if (!spa_feature_is_active(spa, SPA_FEATURE_LOG_SPACEMAP)) + return; + (void) printf("\nLog Space Maps in Pool:\n"); for (spa_log_sm_t *sls = avl_first(&spa->spa_sm_logs_by_txg); sls; sls = AVL_NEXT(&spa->spa_sm_logs_by_txg, sls)) { @@ -5823,6 +5826,9 @@ log_spacemap_obsolete_stats_cb(spa_t *spa, space_map_entry_t *sme, static void dump_log_spacemap_obsolete_stats(spa_t *spa) { + if (!spa_feature_is_active(spa, SPA_FEATURE_LOG_SPACEMAP)) + return; + log_sm_obsolete_stats_arg_t lsos; bzero(&lsos, sizeof (lsos)); -- cgit v1.2.3