From 964c2d69a90c503f44946f31c5d4a8ac4458176d Mon Sep 17 00:00:00 2001 From: Matthew Ahrens Date: Tue, 3 Jan 2017 15:18:33 -0800 Subject: [PATCH] OpenZFS 9236 - nuke spa_dbgmsg We should use zfs_dbgmsg instead of spa_dbgmsg. Or at least, metaslab_condense() should call zfs_dbgmsg because it's important and rare enough to always log. It's possible that the message in zio_dva_allocate() would be too high-frequency for zfs_dbgmsg. Authored by: Matthew Ahrens Reviewed by: Serapheim Dimitropoulos Reviewed by: Pavel Zakharov Reviewed by: George Wilson Reviewed by: Richard Elling Reviewed-by: Brian Behlendorf Approved by: Richard Lowe Ported-by: Giuseppe Di Natale Patch Notes: * Removed ZFS_DEBUG_SPA from zfs-module-parameters.5 OpenZFS-issue: https://www.illumos.org/issues/9236 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/cfaba7f668 Closes #7467 --- cmd/ztest/ztest.c | 5 +---- include/sys/spa.h | 7 ------- include/sys/spa_impl.h | 1 - include/sys/zfs_debug.h | 4 ++-- man/man5/zfs-module-parameters.5 | 3 --- module/zfs/metaslab.c | 4 ++-- module/zfs/spa_misc.c | 10 +--------- module/zfs/zio.c | 2 +- 8 files changed, 7 insertions(+), 29 deletions(-) diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c index 84e13c14a..a4cafcd51 100644 --- a/cmd/ztest/ztest.c +++ b/cmd/ztest/ztest.c @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2016 by Delphix. All rights reserved. + * Copyright (c) 2011, 2017 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2014 Integros [integros.com] @@ -6660,7 +6660,6 @@ ztest_run(ztest_shared_t *zs) */ kernel_init(FREAD | FWRITE); VERIFY0(spa_open(ztest_opts.zo_pool, &spa, FTAG)); - spa->spa_debug = B_TRUE; metaslab_preload_limit = ztest_random(20) + 1; ztest_spa = spa; @@ -6813,7 +6812,6 @@ ztest_freeze(void) kernel_init(FREAD | FWRITE); VERIFY3U(0, ==, spa_open(ztest_opts.zo_pool, &spa, FTAG)); VERIFY3U(0, ==, ztest_dataset_open(0)); - spa->spa_debug = B_TRUE; ztest_spa = spa; /* @@ -6882,7 +6880,6 @@ ztest_freeze(void) VERIFY3U(0, ==, spa_open(ztest_opts.zo_pool, &spa, FTAG)); ASSERT(spa_freeze_txg(spa) == UINT64_MAX); VERIFY3U(0, ==, ztest_dataset_open(0)); - spa->spa_debug = B_TRUE; ztest_spa = spa; txg_wait_synced(spa_get_dsl(spa), 0); ztest_dataset_close(0); diff --git a/include/sys/spa.h b/include/sys/spa.h index eb47c21f6..89f4f5107 100644 --- a/include/sys/spa.h +++ b/include/sys/spa.h @@ -1094,13 +1094,6 @@ _NOTE(CONSTCOND) } while (0) #define dprintf_bp(bp, fmt, ...) #endif -extern boolean_t spa_debug_enabled(spa_t *spa); -#define spa_dbgmsg(spa, ...) \ -{ \ - if (spa_debug_enabled(spa)) \ - zfs_dbgmsg(__VA_ARGS__); \ -} - extern int spa_mode_global; /* mode, e.g. FREAD | FWRITE */ extern int zfs_deadman_enabled; extern unsigned long zfs_deadman_synctime_ms; diff --git a/include/sys/spa_impl.h b/include/sys/spa_impl.h index f49138d0f..90d929268 100644 --- a/include/sys/spa_impl.h +++ b/include/sys/spa_impl.h @@ -306,7 +306,6 @@ struct spa { kcondvar_t spa_suspend_cv; /* notification of resume */ zio_suspend_reason_t spa_suspended; /* pool is suspended */ uint8_t spa_claiming; /* pool is doing zil_claim() */ - boolean_t spa_debug; /* debug enabled? */ boolean_t spa_is_root; /* pool is root */ int spa_minref; /* num refs when first opened */ int spa_mode; /* FREAD | FWRITE */ diff --git a/include/sys/zfs_debug.h b/include/sys/zfs_debug.h index 91b161ff8..aa9bfe21f 100644 --- a/include/sys/zfs_debug.h +++ b/include/sys/zfs_debug.h @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2016 by Delphix. All rights reserved. + * Copyright (c) 2012, 2017 by Delphix. All rights reserved. */ #ifndef _SYS_ZFS_DEBUG_H @@ -48,7 +48,7 @@ extern int zfs_dbgmsg_enable; #define ZFS_DEBUG_DNODE_VERIFY (1 << 2) #define ZFS_DEBUG_SNAPNAMES (1 << 3) #define ZFS_DEBUG_MODIFY (1 << 4) -#define ZFS_DEBUG_SPA (1 << 5) +/* 1<<5 was previously used, try not to reuse */ #define ZFS_DEBUG_ZIO_FREE (1 << 6) #define ZFS_DEBUG_HISTOGRAM_VERIFY (1 << 7) #define ZFS_DEBUG_METASLAB_VERIFY (1 << 8) diff --git a/man/man5/zfs-module-parameters.5 b/man/man5/zfs-module-parameters.5 index 75fd5808b..9d5735bd4 100644 --- a/man/man5/zfs-module-parameters.5 +++ b/man/man5/zfs-module-parameters.5 @@ -1387,9 +1387,6 @@ _ 16 ZFS_DEBUG_MODIFY Check for illegally modified ARC buffers. _ -32 ZFS_DEBUG_SPA - Enable spa_dbgmsg entries in the debug log. -_ 64 ZFS_DEBUG_ZIO_FREE Enable verification of block frees. _ diff --git a/module/zfs/metaslab.c b/module/zfs/metaslab.c index ae98c5143..1dbe1e98c 100644 --- a/module/zfs/metaslab.c +++ b/module/zfs/metaslab.c @@ -1555,7 +1555,7 @@ metaslab_set_fragmentation(metaslab_t *msp) if (spa_writeable(spa) && txg < spa_final_dirty_txg(spa)) { msp->ms_condense_wanted = B_TRUE; vdev_dirty(vd, VDD_METASLAB, msp, txg + 1); - spa_dbgmsg(spa, "txg %llu, requesting force condense: " + zfs_dbgmsg("txg %llu, requesting force condense: " "ms_id %llu, vdev_id %llu", txg, msp->ms_id, vd->vdev_id); } @@ -2081,7 +2081,7 @@ metaslab_condense(metaslab_t *msp, uint64_t txg, dmu_tx_t *tx) ASSERT(msp->ms_loaded); - spa_dbgmsg(spa, "condensing: txg %llu, msp[%llu] %p, vdev id %llu, " + zfs_dbgmsg("condensing: txg %llu, msp[%llu] %p, vdev id %llu, " "spa %s, smp size %llu, segments %lu, forcing condense=%s", txg, msp->ms_id, msp, msp->ms_group->mg_vd->vdev_id, msp->ms_group->mg_vd->vdev_spa->spa_name, diff --git a/module/zfs/spa_misc.c b/module/zfs/spa_misc.c index 54299a7e4..76436ba5c 100644 --- a/module/zfs/spa_misc.c +++ b/module/zfs/spa_misc.c @@ -248,7 +248,7 @@ int spa_mode_global; * by default in debug builds. */ int zfs_flags = ~(ZFS_DEBUG_DPRINTF | ZFS_DEBUG_SET_ERROR | - ZFS_DEBUG_SPA | ZFS_DEBUG_INDIRECT_REMAP); + ZFS_DEBUG_INDIRECT_REMAP); #else int zfs_flags = 0; #endif @@ -659,8 +659,6 @@ spa_add(const char *name, nvlist_t *config, const char *altroot) KM_SLEEP) == 0); } - spa->spa_debug = ((zfs_flags & ZFS_DEBUG_SPA) != 0); - spa->spa_min_ashift = INT_MAX; spa->spa_max_ashift = 0; @@ -2122,12 +2120,6 @@ spa_scan_get_stats(spa_t *spa, pool_scan_stat_t *ps) return (0); } -boolean_t -spa_debug_enabled(spa_t *spa) -{ - return (spa->spa_debug); -} - int spa_maxblocksize(spa_t *spa) { diff --git a/module/zfs/zio.c b/module/zfs/zio.c index 9bb2459bb..b585368be 100644 --- a/module/zfs/zio.c +++ b/module/zfs/zio.c @@ -3295,7 +3295,7 @@ zio_dva_allocate(zio_t *zio) &zio->io_alloc_list, zio); if (error != 0) { - spa_dbgmsg(spa, "%s: metaslab allocation failure: zio %p, " + zfs_dbgmsg("%s: metaslab allocation failure: zio %p, " "size %llu, error %d", spa_name(spa), zio, zio->io_size, error); if (error == ENOSPC && zio->io_size > SPA_MINBLOCKSIZE) -- 2.39.5