From 4f8a53fb73325589dc7741d0f931b3c17d44a7cd Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 5 Dec 2008 10:29:34 -0800 Subject: [PATCH 1/2] Refresh lib-have-spl-debug --- .topdeps | 4 +--- .topmsg | 17 ++--------------- zfs/lib/libzfs/include/libzfs.h | 8 +++++--- zfs/lib/libzpool/include/sys/zfs_debug.h | 5 +++++ zfs/lib/libzpool/spa_misc.c | 5 +++++ 5 files changed, 18 insertions(+), 21 deletions(-) diff --git a/.topdeps b/.topdeps index 607c231780..7f16cbcdd5 100644 --- a/.topdeps +++ b/.topdeps @@ -1,3 +1 @@ -gcc-branch -fix-branch -feature-branch +zfs-branch diff --git a/.topmsg b/.topmsg index e9722e1075..12a0279afc 100644 --- a/.topmsg +++ b/.topmsg @@ -1,19 +1,6 @@ From: Brian Behlendorf -Subject: [PATCH] zfs branch +Subject: [PATCH] linux have spl debug -Merged result of all changes which are relevant to both Solaris -and Linux builds of the ZFS code. These are changes where there -is a reasonable chance they will be accepted upstream. - -Additionally, since this is effectively the root of the linux -ZFS tree the core linux build system is added here. This -includes autogen.sh, configure.ac, m4 macros, some scripts/*, -and makefiles for all the core ZFS components. Linux-only -features which require tweaks to the build system should appear -on the relevant topic branches. All autotools products which -result from autogen.sh are commited to the linux-configure-branch. - -This branch also contains the META, ChangeLog, AUTHORS, -README, and GIT files. +Use spl debug if HAVE_SPL defined Signed-off-by: Brian Behlendorf diff --git a/zfs/lib/libzfs/include/libzfs.h b/zfs/lib/libzfs/include/libzfs.h index c650865f30..ca88e5a5a8 100644 --- a/zfs/lib/libzfs/include/libzfs.h +++ b/zfs/lib/libzfs/include/libzfs.h @@ -524,11 +524,13 @@ extern int zfs_deleg_share_nfs(libzfs_handle_t *, char *, char *, /* * When dealing with nvlists, verify() is extremely useful */ +#ifndef verify #ifdef NDEBUG -#define verify(EX) ((void)(EX)) +#define verify(EX) ((void)(EX)) #else -#define verify(EX) assert(EX) -#endif +#define verify(EX) assert(EX) +#endif /* NDEBUG */ +#endif /* verify */ /* * Utility function to convert a number to a human-readable form. diff --git a/zfs/lib/libzpool/include/sys/zfs_debug.h b/zfs/lib/libzpool/include/sys/zfs_debug.h index 450ac1c81b..ce6b046d6a 100644 --- a/zfs/lib/libzpool/include/sys/zfs_debug.h +++ b/zfs/lib/libzpool/include/sys/zfs_debug.h @@ -57,11 +57,16 @@ extern int zfs_flags; #define ZFS_DEBUG_MODIFY 0x0010 #ifdef ZFS_DEBUG +#if defined(_KERNEL) && defined(HAVE_SPL) +#include +#define dprintf(...) CDEBUG_LIMIT(D_DPRINTF, __VA_ARGS__) +#else extern void __dprintf(const char *file, const char *func, int line, const char *fmt, ...); #define dprintf(...) \ if (zfs_flags & ZFS_DEBUG_DPRINTF) \ __dprintf(__FILE__, __func__, __LINE__, __VA_ARGS__) +#endif /* _KERNEL && HAVE_SPL */ #else #define dprintf(...) ((void)0) #endif /* ZFS_DEBUG */ diff --git a/zfs/lib/libzpool/spa_misc.c b/zfs/lib/libzpool/spa_misc.c index e188b2da16..2e5d3e2ee7 100644 --- a/zfs/lib/libzpool/spa_misc.c +++ b/zfs/lib/libzpool/spa_misc.c @@ -233,8 +233,13 @@ kmem_cache_t *spa_buffer_pool; int spa_mode; #ifdef ZFS_DEBUG +#if defined(_KERNEL) && defined(HAVE_SPL) +/* All filtering done by the SPL */ +int zfs_flags = ~0; +#else /* Everything except dprintf is on by default in debug builds */ int zfs_flags = ~ZFS_DEBUG_DPRINTF; +#endif #else int zfs_flags = 0; #endif From 5b4fa8eb54e84089a03f9b5edd875b2c8a9628be Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 12 Dec 2008 15:26:39 -0800 Subject: [PATCH 2/2] Revert libzfs hunk --- lib/libzfs/include/libzfs.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/libzfs/include/libzfs.h b/lib/libzfs/include/libzfs.h index ca88e5a5a8..c650865f30 100644 --- a/lib/libzfs/include/libzfs.h +++ b/lib/libzfs/include/libzfs.h @@ -524,13 +524,11 @@ extern int zfs_deleg_share_nfs(libzfs_handle_t *, char *, char *, /* * When dealing with nvlists, verify() is extremely useful */ -#ifndef verify #ifdef NDEBUG -#define verify(EX) ((void)(EX)) +#define verify(EX) ((void)(EX)) #else -#define verify(EX) assert(EX) -#endif /* NDEBUG */ -#endif /* verify */ +#define verify(EX) assert(EX) +#endif /* * Utility function to convert a number to a human-readable form.