mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
enable zfs_dbgmsg() by default, without dprintf()
zfs_dbgmsg() should record a message by default. As a general principal, these messages shouldn't be too verbose. Furthermore, the amount of memory used is limited to 4MB (by default). dprintf() should only record a message if this is a debug build, and ZFS_DEBUG_DPRINTF is set in zfs_flags. This flag is not set by default (even on debug builds). These messages are extremely verbose, and sometimes nontrivial to compute. SET_ERROR() should only record a message if ZFS_DEBUG_SET_ERROR is set in zfs_flags. This flag is not set by default (even on debug builds). This brings our behavior in line with illumos. Note that the message format is unchanged (including file, line, and function, even though these are not recorded on illumos). Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Prakash Surya <prakash.surya@delphix.com> Signed-off-by: Matthew Ahrens <mahrens@delphix.com> Closes #7314
This commit is contained in:
committed by
Brian Behlendorf
parent
8d9e7c8fbe
commit
2fd92c3d6c
+16
-3
@@ -41,6 +41,7 @@ extern "C" {
|
||||
extern int zfs_flags;
|
||||
extern int zfs_recover;
|
||||
extern int zfs_free_leak_on_eio;
|
||||
extern int zfs_dbgmsg_enable;
|
||||
|
||||
#define ZFS_DEBUG_DPRINTF (1 << 0)
|
||||
#define ZFS_DEBUG_DBUF_VERIFY (1 << 1)
|
||||
@@ -55,10 +56,22 @@ extern int zfs_free_leak_on_eio;
|
||||
|
||||
extern void __dprintf(const char *file, const char *func,
|
||||
int line, const char *fmt, ...);
|
||||
#define dprintf(...) \
|
||||
__dprintf(__FILE__, __func__, __LINE__, __VA_ARGS__)
|
||||
#define zfs_dbgmsg(...) \
|
||||
__dprintf(__FILE__, __func__, __LINE__, __VA_ARGS__)
|
||||
if (zfs_dbgmsg_enable) \
|
||||
__dprintf(__FILE__, __func__, __LINE__, __VA_ARGS__)
|
||||
|
||||
#ifdef ZFS_DEBUG
|
||||
/*
|
||||
* To enable this:
|
||||
*
|
||||
* $ echo 1 >/sys/module/zfs/parameters/zfs_flags
|
||||
*/
|
||||
#define dprintf(...) \
|
||||
if (zfs_flags & ZFS_DEBUG_DPRINTF) \
|
||||
__dprintf(__FILE__, __func__, __LINE__, __VA_ARGS__)
|
||||
#else
|
||||
#define dprintf(...) ((void)0)
|
||||
#endif /* ZFS_DEBUG */
|
||||
|
||||
extern void zfs_panic_recover(const char *fmt, ...);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user