diff options
-rw-r--r-- | include/os/freebsd/spl/sys/ccompile.h | 9 | ||||
-rw-r--r-- | module/avl/avl.c | 10 | ||||
-rw-r--r-- | module/icp/include/sys/ia32/stack.h | 2 | ||||
-rw-r--r-- | module/os/freebsd/spl/callb.c | 4 | ||||
-rw-r--r-- | module/os/freebsd/zfs/dmu_os.c | 4 | ||||
-rw-r--r-- | module/os/freebsd/zfs/zfs_dir.c | 2 | ||||
-rw-r--r-- | module/os/freebsd/zfs/zfs_vnops.c | 4 | ||||
-rw-r--r-- | module/os/freebsd/zfs/zfs_znode.c | 2 | ||||
-rw-r--r-- | module/os/linux/zfs/zfs_dir.c | 4 | ||||
-rw-r--r-- | module/os/linux/zfs/zfs_ioctl_os.c | 2 | ||||
-rw-r--r-- | module/os/linux/zfs/zfs_vnops.c | 4 | ||||
-rw-r--r-- | module/zfs/dbuf.c | 4 | ||||
-rw-r--r-- | module/zfs/dnode_sync.c | 4 | ||||
-rw-r--r-- | module/zfs/dsl_dir.c | 2 | ||||
-rw-r--r-- | module/zfs/metaslab.c | 2 | ||||
-rw-r--r-- | module/zfs/multilist.c | 2 | ||||
-rw-r--r-- | module/zfs/rrwlock.c | 4 | ||||
-rw-r--r-- | module/zfs/space_map.c | 4 | ||||
-rw-r--r-- | module/zfs/zfs_ioctl.c | 4 |
19 files changed, 39 insertions, 34 deletions
diff --git a/include/os/freebsd/spl/sys/ccompile.h b/include/os/freebsd/spl/sys/ccompile.h index 4dda0756f..116612b61 100644 --- a/include/os/freebsd/spl/sys/ccompile.h +++ b/include/os/freebsd/spl/sys/ccompile.h @@ -119,9 +119,11 @@ extern "C" { #define __CONST __sun_attr__((__const__)) #define __PURE __sun_attr__((__pure__)) -#if (defined(ZFS_DEBUG) || !defined(NDEBUG))&& !defined(DEBUG) -#define DEBUG +#ifdef INVARIANTS +#define ZFS_DEBUG +#undef NDEBUG #endif + #define EXPORT_SYMBOL(x) #define MODULE_AUTHOR(s) #define MODULE_DESCRIPTION(s) @@ -134,6 +136,9 @@ extern "C" { #ifdef ZFS_DEBUG #undef NDEBUG #endif +#if !defined(ZFS_DEBUG) && !defined(NDEBUG) +#define NDEBUG +#endif #ifndef EINTEGRITY #define EINTEGRITY 97 /* EINTEGRITY is new in 13 */ diff --git a/module/avl/avl.c b/module/avl/avl.c index cfe153a4c..9cc836239 100644 --- a/module/avl/avl.c +++ b/module/avl/avl.c @@ -269,7 +269,7 @@ avl_find(avl_tree_t *tree, const void *value, avl_index_t *where) diff = tree->avl_compar(value, AVL_NODE2DATA(node, off)); ASSERT(-1 <= diff && diff <= 1); if (diff == 0) { -#ifdef DEBUG +#ifdef ZFS_DEBUG if (where != NULL) *where = 0; #endif @@ -578,7 +578,7 @@ avl_insert_here( { avl_node_t *node; int child = direction; /* rely on AVL_BEFORE == 0, AVL_AFTER == 1 */ -#ifdef DEBUG +#ifdef ZFS_DEBUG int diff; #endif @@ -593,7 +593,7 @@ avl_insert_here( */ node = AVL_DATA2NODE(here, tree->avl_offset); -#ifdef DEBUG +#ifdef ZFS_DEBUG diff = tree->avl_compar(new_data, here); ASSERT(-1 <= diff && diff <= 1); ASSERT(diff != 0); @@ -604,7 +604,7 @@ avl_insert_here( node = node->avl_child[child]; child = 1 - child; while (node->avl_child[child] != NULL) { -#ifdef DEBUG +#ifdef ZFS_DEBUG diff = tree->avl_compar(new_data, AVL_NODE2DATA(node, tree->avl_offset)); ASSERT(-1 <= diff && diff <= 1); @@ -613,7 +613,7 @@ avl_insert_here( #endif node = node->avl_child[child]; } -#ifdef DEBUG +#ifdef ZFS_DEBUG diff = tree->avl_compar(new_data, AVL_NODE2DATA(node, tree->avl_offset)); ASSERT(-1 <= diff && diff <= 1); diff --git a/module/icp/include/sys/ia32/stack.h b/module/icp/include/sys/ia32/stack.h index c4deb7bca..9e7c089e1 100644 --- a/module/icp/include/sys/ia32/stack.h +++ b/module/icp/include/sys/ia32/stack.h @@ -126,7 +126,7 @@ extern "C" { #if defined(_KERNEL) && !defined(_ASM) -#if defined(DEBUG) +#if defined(ZFS_DEBUG) #if STACK_ALIGN == 4 #define ASSERT_STACK_ALIGNED() \ { \ diff --git a/module/os/freebsd/spl/callb.c b/module/os/freebsd/spl/callb.c index 8db8e69b3..633e85bc0 100644 --- a/module/os/freebsd/spl/callb.c +++ b/module/os/freebsd/spl/callb.c @@ -154,7 +154,7 @@ callb_add_common(boolean_t (*func)(void *arg, int code), cp->c_arg = arg; cp->c_class = (uchar_t)class; cp->c_flag |= CALLB_TAKEN; -#ifdef DEBUG +#ifdef ZFS_DEBUG if (strlen(name) > CB_MAXNAME) cmn_err(CE_WARN, "callb_add: name of callback function '%s' " "too long -- truncated to %d chars", @@ -217,7 +217,7 @@ callb_delete(callb_id_t id) while (*pp != NULL && *pp != me) pp = &(*pp)->c_next; -#ifdef DEBUG +#ifdef ZFS_DEBUG if (*pp != me) { cmn_err(CE_WARN, "callb delete bogus entry 0x%p", (void *)me); diff --git a/module/os/freebsd/zfs/dmu_os.c b/module/os/freebsd/zfs/dmu_os.c index 0c806df66..4d367af31 100644 --- a/module/os/freebsd/zfs/dmu_os.c +++ b/module/os/freebsd/zfs/dmu_os.c @@ -174,7 +174,7 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_t *ma, int count, if (err != 0) return (err); -#ifdef DEBUG +#ifdef ZFS_DEBUG IMPLY(last_size < PAGE_SIZE, *rahead == 0); if (dbp[0]->db_offset != 0 || numbufs > 1) { for (i = 0; i < numbufs; i++) { @@ -269,7 +269,7 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_t *ma, int count, } } -#ifdef DEBUG +#ifdef ZFS_DEBUG /* * Three possibilities: * - last requested page ends at a buffer boundary and , thus, diff --git a/module/os/freebsd/zfs/zfs_dir.c b/module/os/freebsd/zfs/zfs_dir.c index 2c32602b1..5aa4cd525 100644 --- a/module/os/freebsd/zfs/zfs_dir.c +++ b/module/os/freebsd/zfs/zfs_dir.c @@ -839,7 +839,7 @@ zfs_make_xattrdir(znode_t *zp, vattr_t *vap, znode_t **xvpp, cred_t *cr) if (fuid_dirtied) zfs_fuid_sync(zfsvfs, tx); -#ifdef DEBUG +#ifdef ZFS_DEBUG error = sa_lookup(xzp->z_sa_hdl, SA_ZPL_PARENT(zfsvfs), &parent, sizeof (parent)); ASSERT(error == 0 && parent == zp->z_id); diff --git a/module/os/freebsd/zfs/zfs_vnops.c b/module/os/freebsd/zfs/zfs_vnops.c index 1f1c0cb93..14ad71d11 100644 --- a/module/os/freebsd/zfs/zfs_vnops.c +++ b/module/os/freebsd/zfs/zfs_vnops.c @@ -1271,7 +1271,7 @@ zfs_get_done(zgd_t *zgd, int error) kmem_free(zgd, sizeof (zgd_t)); } -#ifdef DEBUG +#ifdef ZFS_DEBUG static int zil_fault_io = 0; #endif @@ -1354,7 +1354,7 @@ zfs_get_data(void *arg, lr_write_t *lr, char *buf, struct lwb *lwb, zio_t *zio) /* test for truncation needs to be done while range locked */ if (lr->lr_offset >= zp->z_size) error = SET_ERROR(ENOENT); -#ifdef DEBUG +#ifdef ZFS_DEBUG if (zil_fault_io) { error = SET_ERROR(EIO); zil_fault_io = 0; diff --git a/module/os/freebsd/zfs/zfs_znode.c b/module/os/freebsd/zfs/zfs_znode.c index 8a2e55c67..badf159ca 100644 --- a/module/os/freebsd/zfs/zfs_znode.c +++ b/module/os/freebsd/zfs/zfs_znode.c @@ -76,7 +76,7 @@ SYSCTL_INT(_debug_sizeof, OID_AUTO, znode, CTLFLAG_RD, * Define ZNODE_STATS to turn on statistic gathering. By default, it is only * turned on when DEBUG is also defined. */ -#ifdef DEBUG +#ifdef ZFS_DEBUG #define ZNODE_STATS #endif /* DEBUG */ diff --git a/module/os/linux/zfs/zfs_dir.c b/module/os/linux/zfs/zfs_dir.c index 591e35fd1..383657208 100644 --- a/module/os/linux/zfs/zfs_dir.c +++ b/module/os/linux/zfs/zfs_dir.c @@ -1059,7 +1059,7 @@ zfs_make_xattrdir(znode_t *zp, vattr_t *vap, znode_t **xzpp, cred_t *cr) int error; zfs_acl_ids_t acl_ids; boolean_t fuid_dirtied; -#ifdef DEBUG +#ifdef ZFS_DEBUG uint64_t parent; #endif @@ -1095,7 +1095,7 @@ zfs_make_xattrdir(znode_t *zp, vattr_t *vap, znode_t **xzpp, cred_t *cr) if (fuid_dirtied) zfs_fuid_sync(zfsvfs, tx); -#ifdef DEBUG +#ifdef ZFS_DEBUG error = sa_lookup(xzp->z_sa_hdl, SA_ZPL_PARENT(zfsvfs), &parent, sizeof (parent)); ASSERT(error == 0 && parent == zp->z_id); diff --git a/module/os/linux/zfs/zfs_ioctl_os.c b/module/os/linux/zfs/zfs_ioctl_os.c index 068974799..457f4e8ea 100644 --- a/module/os/linux/zfs/zfs_ioctl_os.c +++ b/module/os/linux/zfs/zfs_ioctl_os.c @@ -265,7 +265,7 @@ zfsdev_detach(void) misc_deregister(&zfs_misc); } -#ifdef DEBUG +#ifdef ZFS_DEBUG #define ZFS_DEBUG_STR " (DEBUG mode)" #else #define ZFS_DEBUG_STR "" diff --git a/module/os/linux/zfs/zfs_vnops.c b/module/os/linux/zfs/zfs_vnops.c index 20c2709c9..2d104a500 100644 --- a/module/os/linux/zfs/zfs_vnops.c +++ b/module/os/linux/zfs/zfs_vnops.c @@ -1060,7 +1060,7 @@ zfs_get_done(zgd_t *zgd, int error) kmem_free(zgd, sizeof (zgd_t)); } -#ifdef DEBUG +#ifdef ZFS_DEBUG static int zil_fault_io = 0; #endif @@ -1142,7 +1142,7 @@ zfs_get_data(void *arg, lr_write_t *lr, char *buf, struct lwb *lwb, zio_t *zio) /* test for truncation needs to be done while range locked */ if (lr->lr_offset >= zp->z_size) error = SET_ERROR(ENOENT); -#ifdef DEBUG +#ifdef ZFS_DEBUG if (zil_fault_io) { error = SET_ERROR(EIO); zil_fault_io = 0; diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c index aa44cc31e..83b2c3721 100644 --- a/module/zfs/dbuf.c +++ b/module/zfs/dbuf.c @@ -1989,7 +1989,7 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t *tx) * objects may be dirtied in syncing context, but only if they * were already pre-dirtied in open context. */ -#ifdef DEBUG +#ifdef ZFS_DEBUG if (dn->dn_objset->os_dsl_dataset != NULL) { rrw_enter(&dn->dn_objset->os_dsl_dataset->ds_bp_rwlock, RW_READER, FTAG); @@ -2062,7 +2062,7 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t *tx) */ os = dn->dn_objset; VERIFY3U(tx->tx_txg, <=, spa_final_dirty_txg(os->os_spa)); -#ifdef DEBUG +#ifdef ZFS_DEBUG if (dn->dn_objset->os_dsl_dataset != NULL) rrw_enter(&os->os_dsl_dataset->ds_bp_rwlock, RW_READER, FTAG); ASSERT(!dmu_tx_is_syncing(tx) || DMU_OBJECT_IS_SPECIAL(dn->dn_object) || diff --git a/module/zfs/dnode_sync.c b/module/zfs/dnode_sync.c index 4178d6f07..eafea3403 100644 --- a/module/zfs/dnode_sync.c +++ b/module/zfs/dnode_sync.c @@ -91,7 +91,7 @@ dnode_increase_indirection(dnode_t *dn, dmu_tx_t *tx) if (child == NULL) continue; -#ifdef DEBUG +#ifdef ZFS_DEBUG DB_DNODE_ENTER(child); ASSERT3P(DB_DNODE(child), ==, dn); DB_DNODE_EXIT(child); @@ -462,7 +462,7 @@ dnode_evict_dbufs(dnode_t *dn) mutex_enter(&dn->dn_dbufs_mtx); for (db = avl_first(&dn->dn_dbufs); db != NULL; db = db_next) { -#ifdef DEBUG +#ifdef ZFS_DEBUG DB_DNODE_ENTER(db); ASSERT3P(DB_DNODE(db), ==, dn); DB_DNODE_EXIT(db); diff --git a/module/zfs/dsl_dir.c b/module/zfs/dsl_dir.c index da6103b4b..af369d1c7 100644 --- a/module/zfs/dsl_dir.c +++ b/module/zfs/dsl_dir.c @@ -1553,7 +1553,7 @@ dsl_dir_diduse_space(dsl_dir_t *dd, dd_used_t type, ASSERT(used > 0 || dsl_dir_phys(dd)->dd_used_breakdown[type] >= -used); dsl_dir_phys(dd)->dd_used_breakdown[type] += used; -#ifdef DEBUG +#ifdef ZFS_DEBUG { dd_used_t t; uint64_t u = 0; diff --git a/module/zfs/metaslab.c b/module/zfs/metaslab.c index a935f33cb..1bc27824e 100644 --- a/module/zfs/metaslab.c +++ b/module/zfs/metaslab.c @@ -4401,7 +4401,7 @@ metaslab_trace_add(zio_alloc_list_t *zal, metaslab_group_t *mg, */ if (zal->zal_size == metaslab_trace_max_entries) { metaslab_alloc_trace_t *mat_next; -#ifdef DEBUG +#ifdef ZFS_DEBUG panic("too many entries in allocation list"); #endif METASLABSTAT_BUMP(metaslabstat_trace_over_limit); diff --git a/module/zfs/multilist.c b/module/zfs/multilist.c index 27b17c8f3..a3adfd317 100644 --- a/module/zfs/multilist.c +++ b/module/zfs/multilist.c @@ -33,7 +33,7 @@ int zfs_multilist_num_sublists = 0; * Given the object contained on the list, return a pointer to the * object's multilist_node_t structure it contains. */ -#ifdef DEBUG +#ifdef ZFS_DEBUG static multilist_node_t * multilist_d2l(multilist_t *ml, void *obj) { diff --git a/module/zfs/rrwlock.c b/module/zfs/rrwlock.c index c6d358b34..a2b784837 100644 --- a/module/zfs/rrwlock.c +++ b/module/zfs/rrwlock.c @@ -164,7 +164,7 @@ static void rrw_enter_read_impl(rrwlock_t *rrl, boolean_t prio, void *tag) { mutex_enter(&rrl->rr_lock); -#if !defined(DEBUG) && defined(_KERNEL) +#if !defined(ZFS_DEBUG) && defined(_KERNEL) if (rrl->rr_writer == NULL && !rrl->rr_writer_wanted && !rrl->rr_track_all) { rrl->rr_anon_rcount.rc_count++; @@ -241,7 +241,7 @@ void rrw_exit(rrwlock_t *rrl, void *tag) { mutex_enter(&rrl->rr_lock); -#if !defined(DEBUG) && defined(_KERNEL) +#if !defined(ZFS_DEBUG) && defined(_KERNEL) if (!rrl->rr_writer && rrl->rr_linked_rcount.rc_count == 0) { rrl->rr_anon_rcount.rc_count--; if (rrl->rr_anon_rcount.rc_count == 0) diff --git a/module/zfs/space_map.c b/module/zfs/space_map.c index 25da0e63c..723fa0578 100644 --- a/module/zfs/space_map.c +++ b/module/zfs/space_map.c @@ -675,7 +675,7 @@ space_map_write_impl(space_map_t *sm, range_tree_t *rt, maptype_t maptype, space_map_write_intro_debug(sm, maptype, tx); -#ifdef DEBUG +#ifdef ZFS_DEBUG /* * We do this right after we write the intro debug entry * because the estimate does not take it into account. @@ -736,7 +736,7 @@ space_map_write_impl(space_map_t *sm, range_tree_t *rt, maptype_t maptype, dmu_buf_rele(db, FTAG); -#ifdef DEBUG +#ifdef ZFS_DEBUG /* * We expect our estimation to be based on the worst case * scenario [see comment in space_map_estimate_optimal_size()]. diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c index 1d2ae6270..672eec9cc 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -4806,7 +4806,7 @@ zfs_allow_log_destroy(void *arg) kmem_strfree(poolname); } -#ifdef DEBUG +#ifdef ZFS_DEBUG static boolean_t zfs_ioc_recv_inject_err; #endif @@ -5019,7 +5019,7 @@ zfs_ioc_recv_impl(char *tofs, char *tosnap, char *origin, nvlist_t *recvprops, } *read_bytes = off - noff; -#ifdef DEBUG +#ifdef ZFS_DEBUG if (zfs_ioc_recv_inject_err) { zfs_ioc_recv_inject_err = B_FALSE; error = 1; |