From 49c7595ad87f5d1e5e729d43810d835e088ef04d Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 20 Jul 2010 13:36:50 -0700 Subject: [PATCH 1/2] Replace SBUG with PANIC macro The SBUG macro has been removed from the SPL and replaced with PANIC which is closer to an existing API. Simply update the usage in vdev_disk.c. --- module/zfs/vdev_disk.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/module/zfs/vdev_disk.c b/module/zfs/vdev_disk.c index 799587a809..dbf9b08e76 100644 --- a/module/zfs/vdev_disk.c +++ b/module/zfs/vdev_disk.c @@ -235,15 +235,13 @@ BIO_END_IO_PROTO(vdev_disk_physio_completion, bio, size, error) int rc; /* Fatal error but print some useful debugging before asserting */ - if (dr == NULL) { - printk("FATAL: bio->bi_private == NULL\n" - "bi_next: %p, bi_flags: %lx, bi_rw: %lu, bi_vcnt: %d\n" - "bi_idx: %d, bi_size: %d, bi_end_io: %p, bi_cnt: %d\n", - bio->bi_next, bio->bi_flags, bio->bi_rw, bio->bi_vcnt, - bio->bi_idx, bio->bi_size, bio->bi_end_io, - atomic_read(&bio->bi_cnt)); - SBUG(); - } + if (dr == NULL) + PANIC("dr == NULL, bio->bi_private == NULL\n" + "bi_next: %p, bi_flags: %lx, bi_rw: %lu, bi_vcnt: %d\n" + "bi_idx: %d, bi_size: %d, bi_end_io: %p, bi_cnt: %d\n", + bio->bi_next, bio->bi_flags, bio->bi_rw, bio->bi_vcnt, + bio->bi_idx, bio->bi_size, bio->bi_end_io, + atomic_read(&bio->bi_cnt)); #ifndef HAVE_2ARGS_BIO_END_IO_T if (bio->bi_size) From 99d3042bc82342754be149a2ce0f605982df9c2a Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 20 Jul 2010 13:39:28 -0700 Subject: [PATCH 2/2] Update to use reworked SPL debugging This change updates the ZFS code to use the slightly reworked SPL debug infrastructure. It also explicitly sets all ZFS dprintf debugging to use the SS_USER1 subsystem for logging in the SPL debug log. --- module/zfs/include/sys/zfs_debug.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/module/zfs/include/sys/zfs_debug.h b/module/zfs/include/sys/zfs_debug.h index 3f3d8125e8..f08d7cd2bc 100644 --- a/module/zfs/include/sys/zfs_debug.h +++ b/module/zfs/include/sys/zfs_debug.h @@ -55,8 +55,16 @@ extern int zfs_flags; #ifdef ZFS_DEBUG #if defined(_KERNEL) && defined(HAVE_SPL) -#include -#define dprintf(...) CDEBUG_LIMIT(D_DPRINTF, __VA_ARGS__) +/* + * Log ZFS debug messages as the spl SS_USER1 subsystem. + */ +#include + +#ifdef SS_DEBUG_SUBSYS +#undef SS_DEBUG_SUBSYS +#endif +#define SS_DEBUG_SUBSYS SS_USER1 +#define dprintf(...) SDEBUG_LIMIT(SD_DPRINTF, __VA_ARGS__) #else extern void __dprintf(const char *file, const char *func, int line, const char *fmt, ...);