Make use of ZFS_DEBUG consistent within kmod sources
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Matt Macy <mmacy@FreeBSD.org> Closes #10623
This commit is contained in:
parent
f5b189f937
commit
6d8da84106
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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() \
|
||||
{ \
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 ""
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) ||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()].
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue