mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Add dbgmsg kstat
Internally ZFS keeps a small log to facilitate debugging. By default the log is disabled, to enable it set zfs_dbgmsg_enable=1. The contents of the log can be accessed by reading the /proc/spl/kstat/zfs/dbgmsg file. Writing 0 to this proc file clears the log. $ echo 1 >/sys/module/zfs/parameters/zfs_dbgmsg_enable $ echo 0 >/proc/spl/kstat/zfs/dbgmsg $ zpool import tank $ cat /proc/spl/kstat/zfs/dbgmsg 1 0 0x01 -1 0 2492357525542 2525836565501 timestamp message 1441141408 spa=tank async request task=1 1441141408 txg 70 open pool version 5000; software version 5000/5; ... 1441141409 spa=tank async request task=32 1441141409 txg 72 import pool version 5000; software version 5000/5; ... 1441141414 command: lt-zpool import tank Note the zfs_dbgmsg() and dprintf() functions are both now mapped to the same log. As mentioned above the kernel debug log can be accessed though the /proc/spl/kstat/zfs/dbgmsg kstat. For user space consumers log messages are immediately written to stdout after applying the ZFS_DEBUG environment variable. $ ZFS_DEBUG=on ./cmd/ztest/ztest -V Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ned Bass <bass6@llnl.gov> Closes #3728
This commit is contained in:
@@ -36,32 +36,6 @@
|
||||
* be guarded separately.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Generic support for one argument tracepoints of the form:
|
||||
*
|
||||
* DTRACE_PROBE1(...,
|
||||
* const char *, ...);
|
||||
*/
|
||||
|
||||
DECLARE_EVENT_CLASS(zfs_dbgmsg_class,
|
||||
TP_PROTO(const char *msg),
|
||||
TP_ARGS(msg),
|
||||
TP_STRUCT__entry(
|
||||
__string(msg, msg)
|
||||
),
|
||||
TP_fast_assign(
|
||||
__assign_str(msg, msg);
|
||||
),
|
||||
TP_printk("%s", __get_str(msg))
|
||||
);
|
||||
|
||||
#define DEFINE_DBGMSG_EVENT(name) \
|
||||
DEFINE_EVENT(zfs_dbgmsg_class, name, \
|
||||
TP_PROTO(const char *msg), \
|
||||
TP_ARGS(msg))
|
||||
DEFINE_DBGMSG_EVENT(zfs_zfs__dbgmsg);
|
||||
|
||||
|
||||
/*
|
||||
* Generic support for four argument tracepoints of the form:
|
||||
*
|
||||
|
||||
@@ -51,28 +51,24 @@ extern int zfs_free_leak_on_eio;
|
||||
#define ZFS_DEBUG_ZIO_FREE (1<<6)
|
||||
#define ZFS_DEBUG_HISTOGRAM_VERIFY (1<<7)
|
||||
|
||||
#if defined(HAVE_DECLARE_EVENT_CLASS) || !defined(_KERNEL)
|
||||
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__)
|
||||
#else
|
||||
#define dprintf(...) ((void)0)
|
||||
#endif /* HAVE_DECLARE_EVENT_CLASS || !_KERNEL */
|
||||
__dprintf(__FILE__, __func__, __LINE__, __VA_ARGS__)
|
||||
#define zfs_dbgmsg(...) \
|
||||
__dprintf(__FILE__, __func__, __LINE__, __VA_ARGS__)
|
||||
|
||||
extern void zfs_panic_recover(const char *fmt, ...);
|
||||
|
||||
typedef struct zfs_dbgmsg {
|
||||
list_node_t zdm_node;
|
||||
time_t zdm_timestamp;
|
||||
int zdm_size;
|
||||
char zdm_msg[1]; /* variable length allocation */
|
||||
} zfs_dbgmsg_t;
|
||||
|
||||
extern void zfs_dbgmsg_init(void);
|
||||
extern void zfs_dbgmsg_fini(void);
|
||||
extern void zfs_dbgmsg(const char *fmt, ...);
|
||||
extern void zfs_dbgmsg_print(const char *tag);
|
||||
|
||||
#ifndef _KERNEL
|
||||
extern int dprintf_find_string(const char *string);
|
||||
|
||||
Reference in New Issue
Block a user