diff options
author | Brian Behlendorf <[email protected]> | 2012-01-20 16:39:12 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2012-02-02 11:27:54 -0800 |
commit | 4b2220f0b937018b79154ac368c845e6176a8a66 (patch) | |
tree | 07877c960d2d94a913e8d38c0421e21bacb3592c /module | |
parent | 3c6ed5410beb7a4f9e0c042229eb63c4c11a5fc9 (diff) |
Add --enable-debug-log configure option
Until now the notion of an internal debug logging infrastructure
was conflated with enabling ASSERT()s. This patch clarifies things
by cleanly breaking the two subsystem apart. The result of this
is the following behavior.
--enable-debug - Enable/disable code wrapped in ASSERT()s.
--disable-debug ASSERT()s are used to check invariants and
are never required for correct operation.
They are disabled by default because they
may impact performance.
--enable-debug-log - Enable/disable the debug log infrastructure.
--disable-debug-log This infrastructure allows the spl code and
its consumer to log messages to an in-kernel
log. The granularity of the logging can be
controlled by a debug mask. By default the
mask disables most debug messages resulting
in a negligible performance impact. Because
of this the debug log is enabled by default.
Signed-off-by: Brian Behlendorf <[email protected]>
Diffstat (limited to 'module')
-rw-r--r-- | module/spl/spl-debug.c | 5 | ||||
-rw-r--r-- | module/spl/spl-err.c | 2 | ||||
-rw-r--r-- | module/spl/spl-kmem.c | 2 | ||||
-rw-r--r-- | module/spl/spl-proc.c | 8 |
4 files changed, 15 insertions, 2 deletions
diff --git a/module/spl/spl-debug.c b/module/spl/spl-debug.c index 0dbbb5a7c..4bcc34a8e 100644 --- a/module/spl/spl-debug.c +++ b/module/spl/spl-debug.c @@ -47,6 +47,9 @@ #define SS_DEBUG_SUBSYS SS_DEBUG +/* Debug log support enabled */ +#ifdef DEBUG_LOG + unsigned long spl_debug_subsys = ~0; EXPORT_SYMBOL(spl_debug_subsys); module_param(spl_debug_subsys, ulong, 0644); @@ -1248,3 +1251,5 @@ spl_debug_fini(void) { trace_fini(); } + +#endif /* DEBUG_LOG */ diff --git a/module/spl/spl-err.c b/module/spl/spl-err.c index 200028f3b..c837d1eaa 100644 --- a/module/spl/spl-err.c +++ b/module/spl/spl-err.c @@ -34,7 +34,7 @@ #define SS_DEBUG_SUBSYS SS_GENERIC -#ifndef NDEBUG +#ifdef DEBUG_LOG static char ce_prefix[CE_IGNORE][10] = { "", "NOTICE: ", "WARNING: ", "" }; static char ce_suffix[CE_IGNORE][2] = { "", "\n", "\n", "" }; #endif diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c index 5a6011ad6..446dab128 100644 --- a/module/spl/spl-kmem.c +++ b/module/spl/spl-kmem.c @@ -672,7 +672,7 @@ kmem_alloc_debug(size_t size, int flags, const char *func, int line, "large kmem_alloc(%llu, 0x%x) at %s:%d (%lld/%llu)\n", (unsigned long long) size, flags, func, line, kmem_alloc_used_read(), kmem_alloc_max); - spl_debug_dumpstack(NULL); + dump_stack(); } /* Use the correct allocator */ diff --git a/module/spl/spl-proc.c b/module/spl/spl-proc.c index 745b10714..8149143ae 100644 --- a/module/spl/spl-proc.c +++ b/module/spl/spl-proc.c @@ -125,6 +125,7 @@ enum { CTL_HW_SERIAL, /* Hardware serial number from hostid */ CTL_KALLSYMS, /* Address of kallsyms_lookup_name */ +#ifdef DEBUG_LOG CTL_DEBUG_SUBSYS, /* Debug subsystem */ CTL_DEBUG_MASK, /* Debug mask */ CTL_DEBUG_PRINTK, /* Force all messages to console */ @@ -136,6 +137,7 @@ enum { CTL_DEBUG_DUMP, /* Dump debug buffer to file */ CTL_DEBUG_FORCE_BUG, /* Hook to force a BUG */ CTL_DEBUG_STACK_SIZE, /* Max observed stack size */ +#endif CTL_CONSOLE_RATELIMIT, /* Ratelimit console messages */ CTL_CONSOLE_MAX_DELAY_CS, /* Max delay which we skip messages */ @@ -221,6 +223,7 @@ proc_copyout_string(char *ubuffer, int ubuffer_size, return size; } +#ifdef DEBUG_LOG SPL_PROC_HANDLER(proc_dobitmasks) { unsigned long *mask = table->data; @@ -407,6 +410,7 @@ SPL_PROC_HANDLER(proc_console_backoff) SRETURN(rc); } +#endif /* DEBUG_LOG */ #ifdef DEBUG_KMEM SPL_PROC_HANDLER(proc_domemused) @@ -716,6 +720,7 @@ static struct file_operations proc_slab_operations = { }; #endif /* DEBUG_KMEM */ +#ifdef DEBUG_LOG static struct ctl_table spl_debug_table[] = { { CTL_NAME (CTL_DEBUG_SUBSYS) @@ -829,6 +834,7 @@ static struct ctl_table spl_debug_table[] = { }, {0}, }; +#endif /* DEBUG_LOG */ static struct ctl_table spl_vm_table[] = { { @@ -1056,12 +1062,14 @@ static struct ctl_table spl_table[] = { .proc_handler = &proc_dokallsyms_lookup_name, }, #endif +#ifdef DEBUG_LOG { CTL_NAME (CTL_SPL_DEBUG) .procname = "debug", .mode = 0555, .child = spl_debug_table, }, +#endif { CTL_NAME (CTL_SPL_VM) .procname = "vm", |