From 475cdc788e2ab926b4604724f3c7b4c65d5c1345 Mon Sep 17 00:00:00 2001 From: behlendo Date: Wed, 4 Jun 2008 21:09:25 +0000 Subject: [PATCH] Just use CONFIG_SLUB to detect SLUB use Add ASSERTF to the NDEBUG build Fix minor issue with various debug build flags git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@126 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c --- autoconf/spl-build.m4 | 66 ++++++++++++++++++++---------------------- configure.ac | 1 - include/sys/debug.h | 2 ++ modules/spl/spl-kmem.c | 2 +- 4 files changed, 35 insertions(+), 36 deletions(-) diff --git a/autoconf/spl-build.m4 b/autoconf/spl-build.m4 index db09606..d77c7aa 100644 --- a/autoconf/spl-build.m4 +++ b/autoconf/spl-build.m4 @@ -81,19 +81,20 @@ AC_DEFUN([SPL_AC_DEBUG], [ [Enable generic debug support (default off)]), [ case "$enableval" in yes) spl_ac_debug=yes ;; - no) spl_ac_debug=no ;; + no) spl_ac_debug=no ;; *) AC_MSG_RESULT([Error!]) AC_MSG_ERROR([Bad value "$enableval" for --enable-debug]) ;; esac ] ) if test "$spl_ac_debug" = yes; then + AC_MSG_RESULT([yes]) KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG" else - KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG" + AC_MSG_RESULT([no]) AC_DEFINE([NDEBUG], [1], [Define to 1 to disable debug tracing]) + KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG" fi - AC_MSG_RESULT([${spl_ac_debug=no}]) ]) AC_DEFUN([SPL_AC_DEBUG_KMEM], [ @@ -102,18 +103,20 @@ AC_DEFUN([SPL_AC_DEBUG_KMEM], [ AS_HELP_STRING([--enable-debug-kmem], [Enable kmem debug support (default off)]), [ case "$enableval" in - yes) spl_ac_debug=yes ;; - no) spl_ac_debug=no ;; + yes) spl_ac_debug_kmem=yes ;; + no) spl_ac_debug_kmem=no ;; *) AC_MSG_RESULT([Error!]) AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-kmem]) ;; esac ] ) - if test "$spl_ac_debug" = yes; then - KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM" + if test "$spl_ac_debug_kmem" = yes; then + AC_MSG_RESULT([yes]) AC_DEFINE([DEBUG_KMEM], [1], [Define to 1 to enable kmem debugging]) + KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM" + else + AC_MSG_RESULT([no]) fi - AC_MSG_RESULT([${spl_ac_debug=no}]) ]) AC_DEFUN([SPL_AC_DEBUG_MUTEX], [ @@ -122,18 +125,20 @@ AC_DEFUN([SPL_AC_DEBUG_MUTEX], [ AS_HELP_STRING([--enable-debug-mutex], [Enable mutex debug support (default off)]), [ case "$enableval" in - yes) spl_ac_debug=yes ;; - no) spl_ac_debug=no ;; + yes) spl_ac_debug_mutex=yes ;; + no) spl_ac_debug_mutex=no ;; *) AC_MSG_RESULT([Error!]) AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-mutex]) ;; esac ] ) - if test "$spl_ac_debug" = yes; then - KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_MUTEX" + if test "$spl_ac_debug_mutex" = yes; then + AC_MSG_RESULT([yes]) AC_DEFINE([DEBUG_MUTEX], [1], [Define to 1 to enable mutex debugging]) + KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_MUTEX" + else + AC_MSG_RESULT([no]) fi - AC_MSG_RESULT([${spl_ac_debug=no}]) ]) AC_DEFUN([SPL_AC_DEBUG_KSTAT], [ @@ -142,18 +147,20 @@ AC_DEFUN([SPL_AC_DEBUG_KSTAT], [ AS_HELP_STRING([--enable-debug-kstat], [Enable kstat debug support (default off)]), [ case "$enableval" in - yes) spl_ac_debug=yes ;; - no) spl_ac_debug=no ;; + yes) spl_ac_debug_kstat=yes ;; + no) spl_ac_debug_kstat=no ;; *) AC_MSG_RESULT([Error!]) AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-kstat]) ;; esac ] ) - if test "$spl_ac_debug" = yes; then - KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KSTAT" + if test "$spl_ac_debug_kstat" = yes; then + AC_MSG_RESULT([yes]) AC_DEFINE([DEBUG_KSTAT], [1], [Define to 1 to enable kstat debugging]) + KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KSTAT" + else + AC_MSG_RESULT([no]) fi - AC_MSG_RESULT([${spl_ac_debug=no}]) ]) AC_DEFUN([SPL_AC_DEBUG_CALLB], [ @@ -162,18 +169,20 @@ AC_DEFUN([SPL_AC_DEBUG_CALLB], [ AS_HELP_STRING([--enable-debug-callb], [Enable callb debug support (default off)]), [ case "$enableval" in - yes) spl_ac_debug=yes ;; - no) spl_ac_debug=no ;; + yes) spl_ac_debug_callb=yes ;; + no) spl_ac_debug_callb=no ;; *) AC_MSG_RESULT([Error!]) AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-callb]) ;; esac ] ) - if test "$spl_ac_debug" = yes; then - KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_CALLB" + if test "$spl_ac_debug_callb" = yes; then + AC_MSG_RESULT([yes]) AC_DEFINE([DEBUG_CALLB], [1], [Define to 1 to enable callb debugging]) + KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_CALLB" + else + AC_MSG_RESULT([no]) fi - AC_MSG_RESULT([${spl_ac_debug=no}]) ]) dnl # @@ -280,17 +289,6 @@ AC_DEFUN([SPL_CHECK_SYMBOL_EXPORT], fi ]) -dnl # -dnl # 2.6.x API change -dnl # Slab can now be implemented in terms of the Slub which provides -dnl # slightly different semantics in terms of merged caches. -dnl # -AC_DEFUN([SPL_AC_SLUB], [ - SPL_LINUX_CONFIG([SLUB], - [AC_DEFINE(HAVE_SLUB, 1, [slub support configured])], - []) -]) - dnl # dnl # 2.6.x API change dnl # check if uintptr_t typedef is defined diff --git a/configure.ac b/configure.ac index 21e901d..df210ee 100644 --- a/configure.ac +++ b/configure.ac @@ -43,7 +43,6 @@ SPL_AC_DEBUG_KMEM SPL_AC_DEBUG_MUTEX SPL_AC_DEBUG_KSTAT SPL_AC_DEBUG_CALLB -SPL_AC_SLUB SPL_AC_TYPE_UINTPTR_T SPL_AC_TYPE_KMEM_CACHE_T SPL_AC_KMEM_CACHE_DESTROY_INT diff --git a/include/sys/debug.h b/include/sys/debug.h index 7385b35..53050fc 100644 --- a/include/sys/debug.h +++ b/include/sys/debug.h @@ -192,6 +192,7 @@ struct page_collection { #ifdef NDEBUG #define CDEBUG_STACK() (0) +#define __CDEBUG_LIMIT(x, y, z, a...) ((void)0) #define CDEBUG(mask, format, a...) ((void)0) #define CWARN(fmt, a...) ((void)0) #define CERROR(fmt, a...) ((void)0) @@ -206,6 +207,7 @@ struct page_collection { #define __ASSERT(x) ((void)0) #define __ASSERT_TAGE_INVARIANT(x) ((void)0) #define ASSERT(x) ((void)0) +#define ASSERTF(x, y, z...) ((void)0) #define VERIFY(x) ((void)(x)) #define VERIFY3_IMPL(x, y, z, t, f, c) if (x == z) ((void)0) diff --git a/modules/spl/spl-kmem.c b/modules/spl/spl-kmem.c index b254bba..029414f 100644 --- a/modules/spl/spl-kmem.c +++ b/modules/spl/spl-kmem.c @@ -376,7 +376,7 @@ __kmem_cache_create(char *name, size_t size, size_t align, * SLAB_TRACE * SLAB_DESTROY_BY_RCU */ -#ifdef HAVE_SLUB +#ifdef CONFIG_SLUB flags |= SLAB_STORE_USER; #endif -- 2.39.5