diff options
author | Brian Behlendorf <[email protected]> | 2014-11-05 17:30:35 -0500 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2014-11-19 10:35:07 -0800 |
commit | 8d9a23e82cea5d897e9357d569ef364106703d5a (patch) | |
tree | e49678dab2f5b419d630d388aca924a3c6e4fc72 /include | |
parent | 917fef273295616c563bbb0a5f6986cfce543d2f (diff) |
Retire legacy debugging infrastructure
When the SPL was originally written Linux tracepoints were still
in their infancy. Therefore, an entire debugging subsystem was
added to facilite tracing which served us well for many years.
Now that Linux tracepoints have matured they provide all the
functionality of the previous tracing subsystem. Rather than
maintain parallel functionality it makes sense to fully adopt
tracepoints. Therefore, this patch retires the legacy debugging
infrastructure.
See zfsonlinux/zfs@bc9f413 for the tracepoint changes.
Signed-off-by: Ned Bass <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #408
Diffstat (limited to 'include')
-rw-r--r-- | include/Makefile.am | 2 | ||||
-rw-r--r-- | include/spl-debug.h | 276 | ||||
-rw-r--r-- | include/spl-trace.h | 132 | ||||
-rw-r--r-- | include/sys/debug.h | 140 | ||||
-rw-r--r-- | include/sys/kmem.h | 22 |
5 files changed, 60 insertions, 512 deletions
diff --git a/include/Makefile.am b/include/Makefile.am index f9b812de3..3200222db 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -5,8 +5,6 @@ COMMON_H = KERNEL_H = \ $(top_srcdir)/include/splat-ctl.h \ $(top_srcdir)/include/spl-ctl.h \ - $(top_srcdir)/include/spl-debug.h \ - $(top_srcdir)/include/spl-trace.h \ $(top_srcdir)/include/strings.h \ $(top_srcdir)/include/unistd.h diff --git a/include/spl-debug.h b/include/spl-debug.h deleted file mode 100644 index c91b864c2..000000000 --- a/include/spl-debug.h +++ /dev/null @@ -1,276 +0,0 @@ -/*****************************************************************************\ - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. -\*****************************************************************************/ - -/* - * Available debug functions. These function should be used by any - * package which needs to integrate with the SPL log infrastructure. - * - * SDEBUG() - Log debug message with specified mask. - * SDEBUG_LIMIT() - Log just 1 debug message with specified mask. - * SWARN() - Log a warning message. - * SERROR() - Log an error message. - * SEMERG() - Log an emergency error message. - * SCONSOLE() - Log a generic message to the console. - * - * SENTRY - Log entry point to a function. - * SEXIT - Log exit point from a function. - * SRETURN(x) - Log return from a function. - * SGOTO(x, y) - Log goto within a function. - */ - -#ifndef _SPL_DEBUG_INTERNAL_H -#define _SPL_DEBUG_INTERNAL_H - -#include <linux/limits.h> -#include <linux/sched.h> - -#define SS_UNDEFINED 0x00000001 -#define SS_ATOMIC 0x00000002 -#define SS_KOBJ 0x00000004 -#define SS_VNODE 0x00000008 -#define SS_TIME 0x00000010 -#define SS_RWLOCK 0x00000020 -#define SS_THREAD 0x00000040 -#define SS_CONDVAR 0x00000080 -#define SS_MUTEX 0x00000100 -#define SS_RNG 0x00000200 -#define SS_TASKQ 0x00000400 -#define SS_KMEM 0x00000800 -#define SS_DEBUG 0x00001000 -#define SS_GENERIC 0x00002000 -#define SS_PROC 0x00004000 -#define SS_MODULE 0x00008000 -#define SS_CRED 0x00010000 -#define SS_KSTAT 0x00020000 -#define SS_XDR 0x00040000 -#define SS_TSD 0x00080000 -#define SS_ZLIB 0x00100000 -#define SS_USER1 0x01000000 -#define SS_USER2 0x02000000 -#define SS_USER3 0x04000000 -#define SS_USER4 0x08000000 -#define SS_USER5 0x10000000 -#define SS_USER6 0x20000000 -#define SS_USER7 0x40000000 -#define SS_USER8 0x80000000 -#define SS_DEBUG_SUBSYS SS_UNDEFINED - -#define SD_TRACE 0x00000001 -#define SD_INFO 0x00000002 -#define SD_WARNING 0x00000004 -#define SD_ERROR 0x00000008 -#define SD_EMERG 0x00000010 -#define SD_CONSOLE 0x00000020 -#define SD_IOCTL 0x00000040 -#define SD_DPRINTF 0x00000080 -#define SD_OTHER 0x00000100 -#define SD_CANTMASK (SD_ERROR | SD_EMERG | SD_WARNING | SD_CONSOLE) - -/* Debug log support enabled */ -#ifdef DEBUG_LOG - -#define __SDEBUG(cdls, subsys, mask, format, a...) \ -do { \ - if (((mask) & SD_CANTMASK) != 0 || \ - ((spl_debug_mask & (mask)) != 0 && \ - (spl_debug_subsys & (subsys)) != 0)) \ - spl_debug_msg(cdls, subsys, mask, __FILE__, \ - __FUNCTION__, __LINE__, format, ## a); \ -} while (0) - -#define SDEBUG(mask, format, a...) \ - __SDEBUG(NULL, SS_DEBUG_SUBSYS, mask, format, ## a) - -#define __SDEBUG_LIMIT(subsys, mask, format, a...) \ -do { \ - static spl_debug_limit_state_t cdls; \ - \ - __SDEBUG(&cdls, subsys, mask, format, ## a); \ -} while (0) - -#define SDEBUG_LIMIT(mask, format, a...) \ - __SDEBUG_LIMIT(SS_DEBUG_SUBSYS, mask, format, ## a) - -#define SWARN(fmt, a...) SDEBUG_LIMIT(SD_WARNING, fmt, ## a) -#define SERROR(fmt, a...) SDEBUG_LIMIT(SD_ERROR, fmt, ## a) -#define SEMERG(fmt, a...) SDEBUG_LIMIT(SD_EMERG, fmt, ## a) -#define SCONSOLE(mask, fmt, a...) SDEBUG(SD_CONSOLE | (mask), fmt, ## a) - -#define SENTRY SDEBUG(SD_TRACE, "Process entered\n") -#define SEXIT SDEBUG(SD_TRACE, "Process leaving\n") - -#define SRETURN(rc) \ -do { \ - typeof(rc) RETURN__ret = (rc); \ - SDEBUG(SD_TRACE, "Process leaving (rc=%lu : %ld : %lx)\n", \ - (long)RETURN__ret, (long)RETURN__ret, (long)RETURN__ret); \ - return RETURN__ret; \ -} while (0) - -#define SGOTO(label, rc) \ -do { \ - long GOTO__ret = (long)(rc); \ - SDEBUG(SD_TRACE,"Process leaving via %s (rc=%lu : %ld : %lx)\n",\ - #label, (unsigned long)GOTO__ret, (signed long)GOTO__ret, \ - (signed long)GOTO__ret); \ - goto label; \ -} while (0) - -typedef struct { - unsigned long cdls_next; - int cdls_count; - long cdls_delay; -} spl_debug_limit_state_t; - -/* Global debug variables */ -extern unsigned long spl_debug_subsys; -extern unsigned long spl_debug_mask; -extern unsigned long spl_debug_printk; -extern int spl_debug_mb; -extern unsigned int spl_debug_binary; -extern unsigned int spl_debug_catastrophe; -extern unsigned int spl_debug_panic_on_bug; -extern char spl_debug_file_path[PATH_MAX]; -extern unsigned int spl_console_ratelimit; -extern long spl_console_max_delay; -extern long spl_console_min_delay; -extern unsigned int spl_console_backoff; -extern unsigned int spl_debug_stack; - -/* Exported debug functions */ -extern int spl_debug_mask2str(char *str, int size, unsigned long mask, int ss); -extern int spl_debug_str2mask(unsigned long *mask, const char *str, int ss); -extern unsigned long spl_debug_set_mask(unsigned long mask); -extern unsigned long spl_debug_get_mask(void); -extern unsigned long spl_debug_set_subsys(unsigned long mask); -extern unsigned long spl_debug_get_subsys(void); -extern int spl_debug_set_mb(int mb); -extern int spl_debug_get_mb(void); -extern int spl_debug_dumplog(int flags); -extern void spl_debug_dumpstack(struct task_struct *tsk); -extern void spl_debug_bug(char *file, const char *fn, const int line, int fl); -extern int spl_debug_msg(void *arg, int subsys, int mask, const char *file, - const char *fn, const int line, const char *format, ...); -extern int spl_debug_clear_buffer(void); -extern int spl_debug_mark_buffer(char *text); - -int spl_debug_init(void); -void spl_debug_fini(void); - -/* Debug log support disabled */ -#else /* DEBUG_LOG */ - -#define __SDEBUG(x, y, mask, fmt, a...) ((void)0) -#define SDEBUG(mask, fmt, a...) ((void)0) -#define SDEBUG_LIMIT(x, y, fmt, a...) ((void)0) -#define SWARN(fmt, a...) ((void)0) -#define SERROR(fmt, a...) ((void)0) -#define SEMERG(fmt, a...) ((void)0) -#define SCONSOLE(mask, fmt, a...) ((void)0) - -#define SENTRY ((void)0) -#define SEXIT ((void)0) -#define SRETURN(x) return (x) -#define SGOTO(x, y) { ((void)(y)); goto x; } - -static inline unsigned long -spl_debug_set_mask(unsigned long mask) { - return (0); -} - -static inline unsigned long -spl_debug_get_mask(void) { - return (0); -} - -static inline unsigned long -spl_debug_set_subsys(unsigned long mask) { - return (0); -} - -static inline unsigned long -spl_debug_get_subsys(void) { - return (0); -} - -static inline int -spl_debug_set_mb(int mb) { - return (0); -} - -static inline int -spl_debug_get_mb(void) { - return (0); -} - -static inline int -spl_debug_dumplog(int flags) -{ - return (0); -} - -static inline void -spl_debug_dumpstack(struct task_struct *tsk) -{ - return; -} - -static inline void -spl_debug_bug(char *file, const char *fn, const int line, int fl) -{ - return; -} - -static inline int -spl_debug_msg(void *arg, int subsys, int mask, const char *file, - const char *fn, const int line, const char *format, ...) -{ - return (0); -} - -static inline int -spl_debug_clear_buffer(void) -{ - return (0); -} - -static inline int -spl_debug_mark_buffer(char *text) -{ - return (0); -} - -static inline int -spl_debug_init(void) { - return (0); -} - -static inline void -spl_debug_fini(void) { - return; -} - -#endif /* DEBUG_LOG */ - -#endif /* SPL_DEBUG_INTERNAL_H */ diff --git a/include/spl-trace.h b/include/spl-trace.h deleted file mode 100644 index 8ef173e76..000000000 --- a/include/spl-trace.h +++ /dev/null @@ -1,132 +0,0 @@ -/*****************************************************************************\ - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. -\*****************************************************************************/ - -#ifndef _SPL_TRACE_H -#define _SPL_TRACE_H - -#define TCD_MAX_PAGES (5 << (20 - PAGE_SHIFT)) -#define TCD_STOCK_PAGES (TCD_MAX_PAGES) -#define TRACE_CONSOLE_BUFFER_SIZE 1024 - -#define SPL_DEFAULT_MAX_DELAY (600 * HZ) -#define SPL_DEFAULT_MIN_DELAY ((HZ + 1) / 2) -#define SPL_DEFAULT_BACKOFF 2 - -#define DL_NOTHREAD 0x0001 /* Do not create a new thread */ -#define DL_SINGLE_CPU 0x0002 /* Collect pages from this CPU*/ - -typedef struct dumplog_priv { - wait_queue_head_t dp_waitq; - pid_t dp_pid; - int dp_flags; - atomic_t dp_done; -} dumplog_priv_t; - -/* Three trace data types */ -typedef enum { - TCD_TYPE_PROC, - TCD_TYPE_SOFTIRQ, - TCD_TYPE_IRQ, - TCD_TYPE_MAX -} tcd_type_t; - -union trace_data_union { - struct trace_cpu_data { - /* pages with trace records not yet processed by tracefiled */ - struct list_head tcd_pages; - /* number of pages on ->tcd_pages */ - unsigned long tcd_cur_pages; - /* Max number of pages allowed on ->tcd_pages */ - unsigned long tcd_max_pages; - - /* - * preallocated pages to write trace records into. Pages from - * ->tcd_stock_pages are moved to ->tcd_pages by spl_debug_msg(). - * - * This list is necessary, because on some platforms it's - * impossible to perform efficient atomic page allocation in a - * non-blockable context. - * - * Such platforms fill ->tcd_stock_pages "on occasion", when - * tracing code is entered in blockable context. - * - * trace_get_tage_try() tries to get a page from - * ->tcd_stock_pages first and resorts to atomic page - * allocation only if this queue is empty. ->tcd_stock_pages - * is replenished when tracing code is entered in blocking - * context (darwin-tracefile.c:trace_get_tcd()). We try to - * maintain TCD_STOCK_PAGES (40 by default) pages in this - * queue. Atomic allocation is only required if more than - * TCD_STOCK_PAGES pagesful are consumed by trace records all - * emitted in non-blocking contexts. Which is quite unlikely. - */ - struct list_head tcd_stock_pages; - /* number of pages on ->tcd_stock_pages */ - unsigned long tcd_cur_stock_pages; - - unsigned short tcd_shutting_down; - unsigned short tcd_cpu; - unsigned short tcd_type; - /* The factors to share debug memory. */ - unsigned short tcd_pages_factor; - - /* - * This spinlock is needed to workaround the problem of - * set_cpus_allowed() being GPL-only. Since we cannot - * schedule a thread on a specific CPU when dumping the - * pages, we must use the spinlock for mutual exclusion. - */ - spinlock_t tcd_lock; - unsigned long tcd_lock_flags; - } tcd; - char __pad[L1_CACHE_ALIGN(sizeof(struct trace_cpu_data))]; -}; - -extern union trace_data_union (*trace_data[TCD_TYPE_MAX])[NR_CPUS]; - -#define tcd_for_each(tcd, i, j) \ - for (i = 0; i < TCD_TYPE_MAX && trace_data[i]; i++) \ - for (j = 0, ((tcd) = &(*trace_data[i])[j].tcd); \ - j < num_possible_cpus(); j++, (tcd) = &(*trace_data[i])[j].tcd) - -#define tcd_for_each_type_lock(tcd, i, cpu) \ - for (i = 0; i < TCD_TYPE_MAX && trace_data[i] && \ - (tcd = &(*trace_data[i])[cpu].tcd) && \ - trace_lock_tcd(tcd); trace_unlock_tcd(tcd), i++) - -struct trace_page { - struct page *page; /* page itself */ - struct list_head linkage; /* Used by trace_data_union */ - unsigned int used; /* number of bytes used within this page */ - unsigned short cpu; /* cpu that owns this page */ - unsigned short type; /* type(context) of this page */ -}; - -struct page_collection { - struct list_head pc_pages; - spinlock_t pc_lock; - int pc_want_daemon_pages; -}; - -#endif /* SPL_TRACE_H */ diff --git a/include/sys/debug.h b/include/sys/debug.h index 3a4b1352f..cae2d49e4 100644 --- a/include/sys/debug.h +++ b/include/sys/debug.h @@ -30,7 +30,6 @@ * * PANIC() - Panic the node and print message. * ASSERT() - Assert X is true, if not panic. - * ASSERTF() - Assert X is true, if not panic and print message. * ASSERTV() - Wraps a variable declaration which is only used by ASSERT(). * ASSERT3S() - Assert signed X OP Y is true, if not panic. * ASSERT3U() - Assert unsigned X OP Y is true, if not panic. @@ -44,110 +43,69 @@ */ #ifndef _SPL_DEBUG_H -#define _SPL_DEBUG_H +#define _SPL_DEBUG_H -#include <spl-debug.h> - -#ifdef NDEBUG /* Debugging Disabled */ - -/* Define SPL_DEBUG_STR to make clear which ASSERT definitions are used */ -#define SPL_DEBUG_STR "" - -#define PANIC(fmt, a...) \ - spl_PANIC(__FILE__, __FUNCTION__, __LINE__, fmt, ## a) - -#define __ASSERT(x) ((void)0) -#define ASSERT(x) ((void)0) -#define ASSERTF(x, y, z...) ((void)0) -#define ASSERTV(x) -#define VERIFY(cond) \ - (void)(unlikely(!(cond)) && \ - spl_PANIC(__FILE__, __FUNCTION__, __LINE__, \ - "%s", "VERIFY(" #cond ") failed\n")) - -#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE, FMT, CAST) \ - (void)((!((TYPE)(LEFT) OP (TYPE)(RIGHT))) && \ - spl_PANIC(__FILE__, __FUNCTION__, __LINE__, \ - "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ - "failed (" FMT " " #OP " " FMT ")\n", \ - CAST (LEFT), CAST (RIGHT))) - -#define VERIFY3S(x,y,z) VERIFY3_IMPL(x, y, z, int64_t, "%lld", (long long)) -#define VERIFY3U(x,y,z) VERIFY3_IMPL(x, y, z, uint64_t, "%llu", \ - (unsigned long long)) -#define VERIFY3P(x,y,z) VERIFY3_IMPL(x, y, z, uintptr_t, "%p", (void *)) -#define VERIFY0(x) VERIFY3_IMPL(0, ==, x, int64_t, "%lld", (long long)) - -#define ASSERT3S(x,y,z) ((void)0) -#define ASSERT3U(x,y,z) ((void)0) -#define ASSERT3P(x,y,z) ((void)0) -#define ASSERT0(x) ((void)0) - -#else /* Debugging Enabled */ - -/* Define SPL_DEBUG_STR to make clear which ASSERT definitions are used */ -#define SPL_DEBUG_STR " (DEBUG mode)" - -#define PANIC(fmt, a...) \ - spl_PANIC(__FILE__, __FUNCTION__, __LINE__, fmt, ## a) - -/* ASSERTION that is safe to use within the debug system */ -#define __ASSERT(cond) \ -do { \ - if (unlikely(!(cond))) { \ - printk(KERN_EMERG "ASSERTION(" #cond ") failed\n"); \ - BUG(); \ - } \ -} while (0) +/* + * Common DEBUG functionality. + */ +int spl_panic(const char *file, const char *func, int line, + const char *fmt, ...); +void spl_dumpstack(void); -/* ASSERTION that will debug log used outside the debug sysytem */ -#define ASSERT(cond) \ - (void)(unlikely(!(cond)) && \ - spl_PANIC(__FILE__, __FUNCTION__, __LINE__, \ - "%s", "ASSERTION(" #cond ") failed\n")) +#define PANIC(fmt, a...) \ + spl_panic(__FILE__, __FUNCTION__, __LINE__, fmt, ## a) -#define ASSERTF(cond, fmt, a...) \ +#define VERIFY(cond) \ (void)(unlikely(!(cond)) && \ - spl_PANIC(__FILE__, __FUNCTION__, __LINE__, \ - "ASSERTION(" #cond ") failed: " fmt, ## a)) + spl_panic(__FILE__, __FUNCTION__, __LINE__, \ + "%s", "VERIFY(" #cond ") failed\n")) -#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE, FMT, CAST) \ +#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE, FMT, CAST) \ (void)((!((TYPE)(LEFT) OP (TYPE)(RIGHT))) && \ - spl_PANIC(__FILE__, __FUNCTION__, __LINE__, \ - "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ - "failed (" FMT " " #OP " " FMT ")\n", \ - CAST (LEFT), CAST (RIGHT))) + spl_panic(__FILE__, __FUNCTION__, __LINE__, \ + "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ + "failed (" FMT " " #OP " " FMT ")\n", \ + CAST (LEFT), CAST (RIGHT))) -#define VERIFY3S(x,y,z) VERIFY3_IMPL(x, y, z, int64_t, "%lld", (long long)) -#define VERIFY3U(x,y,z) VERIFY3_IMPL(x, y, z, uint64_t, "%llu", \ +#define VERIFY3S(x,y,z) VERIFY3_IMPL(x, y, z, int64_t, "%lld", (long long)) +#define VERIFY3U(x,y,z) VERIFY3_IMPL(x, y, z, uint64_t, "%llu", \ (unsigned long long)) -#define VERIFY3P(x,y,z) VERIFY3_IMPL(x, y, z, uintptr_t, "%p", (void *)) -#define VERIFY0(x) VERIFY3_IMPL(0, ==, x, int64_t, "%lld", (long long)) - -#define ASSERT3S(x,y,z) VERIFY3S(x, y, z) -#define ASSERT3U(x,y,z) VERIFY3U(x, y, z) -#define ASSERT3P(x,y,z) VERIFY3P(x, y, z) -#define ASSERT0(x) VERIFY0(x) +#define VERIFY3P(x,y,z) VERIFY3_IMPL(x, y, z, uintptr_t, "%p", (void *)) +#define VERIFY0(x) VERIFY3_IMPL(0, ==, x, int64_t, "%lld", (long long)) -#define ASSERTV(x) x -#define VERIFY(x) ASSERT(x) - -#endif /* NDEBUG */ +#define CTASSERT_GLOBAL(x) _CTASSERT(x, __LINE__) +#define CTASSERT(x) { _CTASSERT(x, __LINE__); } +#define _CTASSERT(x, y) __CTASSERT(x, y) +#define __CTASSERT(x, y) \ + typedef char __attribute__ ((unused)) \ + __compile_time_assertion__ ## y[(x) ? 1 : -1] /* - * Helpers for the Solaris debug macros above + * Debugging disabled (--disable-debug) */ -extern int spl_PANIC(char *filename, const char *functionname, - int lineno, const char *fmt, ...); +#ifdef NDEBUG + +#define SPL_DEBUG_STR "" +#define ASSERT(x) ((void)0) +#define ASSERTV(x) +#define ASSERT3S(x,y,z) ((void)0) +#define ASSERT3U(x,y,z) ((void)0) +#define ASSERT3P(x,y,z) ((void)0) +#define ASSERT0(x) ((void)0) /* - * Compile-time assertion. The condition 'x' must be constant. + * Debugging enabled (--enable-debug) */ -#define CTASSERT_GLOBAL(x) _CTASSERT(x, __LINE__) -#define CTASSERT(x) { _CTASSERT(x, __LINE__); } -#define _CTASSERT(x, y) __CTASSERT(x, y) -#define __CTASSERT(x, y) \ - typedef char __attribute__ ((unused)) \ - __compile_time_assertion__ ## y[(x) ? 1 : -1] +#else + +#define SPL_DEBUG_STR " (DEBUG mode)" +#define ASSERT(cond) VERIFY(cond) +#define ASSERTV(x) x +#define ASSERT3S(x,y,z) VERIFY3S(x, y, z) +#define ASSERT3U(x,y,z) VERIFY3U(x, y, z) +#define ASSERT3P(x,y,z) VERIFY3P(x, y, z) +#define ASSERT0(x) VERIFY0(x) + +#endif /* NDEBUG */ #endif /* SPL_DEBUG_H */ diff --git a/include/sys/kmem.h b/include/sys/kmem.h index 5875dfff6..936e49d6d 100644 --- a/include/sys/kmem.h +++ b/include/sys/kmem.h @@ -74,27 +74,27 @@ * ship a kernel with CONFIG_RT_MUTEX_TESTER disabled. */ #if !defined(CONFIG_RT_MUTEX_TESTER) && defined(PF_MUTEX_TESTER) -# define PF_NOFS PF_MUTEX_TESTER +#define PF_NOFS PF_MUTEX_TESTER static inline void sanitize_flags(struct task_struct *p, gfp_t *flags) { if (unlikely((p->flags & PF_NOFS) && (*flags & (__GFP_IO|__GFP_FS)))) { -# ifdef NDEBUG - SDEBUG_LIMIT(SD_CONSOLE | SD_WARNING, "Fixing allocation for " - "task %s (%d) which used GFP flags 0x%x with PF_NOFS set\n", - p->comm, p->pid, flags); - spl_debug_dumpstack(p); +#ifdef NDEBUG + printk(KERN_WARNING "Fixing allocation for task %s (%d) " + "which used GFP flags 0x%x with PF_NOFS set\n", + p->comm, p->pid, *flags); + spl_dumpstack(); *flags &= ~(__GFP_IO|__GFP_FS); -# else +#else PANIC("FATAL allocation for task %s (%d) which used GFP " - "flags 0x%x with PF_NOFS set\n", p->comm, p->pid, flags); -# endif /* NDEBUG */ + "flags 0x%x with PF_NOFS set\n", p->comm, p->pid, *flags); +#endif /* NDEBUG */ } } #else -# define PF_NOFS 0x00000000 -# define sanitize_flags(p, fl) ((void)0) +#define PF_NOFS 0x00000000 +#define sanitize_flags(p, fl) ((void)0) #endif /* !defined(CONFIG_RT_MUTEX_TESTER) && defined(PF_MUTEX_TESTER) */ /* |