6347448 non ZFS_DEBUG kernels shouldn't call empty verify functions
authorek110237
Wed, 09 Nov 2005 17:19:27 -0800
changeset 873 adefbfa5f42d
parent 872 3a2ac11314a8
child 874 e972cd30680f
6347448 non ZFS_DEBUG kernels shouldn't call empty verify functions
usr/src/uts/common/fs/zfs/dbuf.c
usr/src/uts/common/fs/zfs/dmu_tx.c
usr/src/uts/common/fs/zfs/dnode.c
usr/src/uts/common/fs/zfs/dnode_sync.c
usr/src/uts/common/fs/zfs/sys/dbuf.h
usr/src/uts/common/fs/zfs/sys/dmu_tx.h
usr/src/uts/common/fs/zfs/sys/dnode.h
--- a/usr/src/uts/common/fs/zfs/dbuf.c	Wed Nov 09 13:58:26 2005 -0800
+++ b/usr/src/uts/common/fs/zfs/dbuf.c	Wed Nov 09 17:19:27 2005 -0800
@@ -39,10 +39,7 @@
 #include <sys/dmu_zfetch.h>
 
 static void dbuf_destroy(dmu_buf_impl_t *db);
-static void dbuf_verify(dmu_buf_impl_t *db);
-static void dbuf_evict_user(dmu_buf_impl_t *db);
 static int dbuf_undirty(dmu_buf_impl_t *db, dmu_tx_t *tx);
-static arc_done_func_t dbuf_read_done;
 static arc_done_func_t dbuf_write_done;
 
 /*
@@ -284,10 +281,10 @@
  * Other stuff.
  */
 
+#ifdef ZFS_DEBUG
 static void
 dbuf_verify(dmu_buf_impl_t *db)
 {
-#ifdef ZFS_DEBUG
 	int i;
 	dnode_t *dn = db->db_dnode;
 
@@ -386,8 +383,8 @@
 			}
 		}
 	}
+}
 #endif
-}
 
 static void
 dbuf_update_data(dmu_buf_impl_t *db)
@@ -854,7 +851,7 @@
 
 	ASSERT(tx->tx_txg != 0);
 	ASSERT(!refcount_is_zero(&db->db_holds));
-	dmu_tx_dirty_buf(tx, db);
+	DMU_TX_DIRTY_BUF(tx, db);
 
 	/*
 	 * Shouldn't dirty a regular buffer in syncing context.  Private
@@ -1149,7 +1146,7 @@
 dbuf_fill_done(dmu_buf_impl_t *db, dmu_tx_t *tx)
 {
 	mutex_enter(&db->db_mtx);
-	dbuf_verify(db);
+	DBUF_VERIFY(db);
 
 	if (db->db_state == DB_FILL) {
 		if (db->db_level == 0 && db->db_d.db_freed_in_flight) {
@@ -1324,7 +1321,7 @@
 	int i;
 
 	ASSERT(MUTEX_HELD(&db->db_mtx));
-	dbuf_verify(db);
+	DBUF_VERIFY(db);
 
 	if (db->db_state != DB_UNCACHED && db->db_state != DB_CACHED)
 		return (FALSE);
@@ -1454,7 +1451,7 @@
 
 	dbuf_add_ref(db, tag);
 	dbuf_update_data(db);
-	dbuf_verify(db);
+	DBUF_VERIFY(db);
 	mutex_exit(&db->db_mtx);
 
 	/* NOTE: we can't rele the parent until after we drop the db_mtx */
@@ -1518,7 +1515,7 @@
 	}
 
 	mutex_enter(&db->db_mtx);
-	dbuf_verify(db);
+	DBUF_VERIFY(db);
 
 	holds = refcount_remove(&db->db_holds, tag);
 
@@ -1634,7 +1631,7 @@
 	} else {
 		ASSERT3U(db->db_state, ==, DB_CACHED);
 	}
-	dbuf_verify(db);
+	DBUF_VERIFY(db);
 
 	/*
 	 * Don't need a lock on db_dirty (dn_mtx), because it can't
@@ -1750,7 +1747,7 @@
 		ASSERT(db->db_parent == NULL);
 		db->db_parent = dn->dn_dbuf;
 		db->db_blkptr = &dn->dn_phys->dn_blkptr[db->db_blkid];
-		dbuf_verify(db);
+		DBUF_VERIFY(db);
 		mutex_exit(&db->db_mtx);
 	} else if (db->db_blkptr == NULL) {
 		dmu_buf_impl_t *parent = db->db_parent;
@@ -1789,7 +1786,7 @@
 
 		db->db_blkptr = (blkptr_t *)parent->db.db_data +
 		    (db->db_blkid & ((1ULL << epbs) - 1));
-		dbuf_verify(db);
+		DBUF_VERIFY(db);
 		mutex_exit(&db->db_mtx);
 	}
 	ASSERT(db->db_parent == NULL || arc_released(db->db_parent->db_buf));
--- a/usr/src/uts/common/fs/zfs/dmu_tx.c	Wed Nov 09 13:58:26 2005 -0800
+++ b/usr/src/uts/common/fs/zfs/dmu_tx.c	Wed Nov 09 17:19:27 2005 -0800
@@ -477,10 +477,10 @@
 	return (holds);
 }
 
+#ifdef ZFS_DEBUG
 void
 dmu_tx_dirty_buf(dmu_tx_t *tx, dmu_buf_impl_t *db)
 {
-#ifdef ZFS_DEBUG
 	dmu_tx_hold_t *dth;
 	int match_object = FALSE, match_offset = FALSE;
 	dnode_t *dn = db->db_dnode;
@@ -566,8 +566,8 @@
 	panic("dirtying dbuf obj=%llx lvl=%u blkid=%llx but not tx_held\n",
 	    (u_longlong_t)db->db.db_object, db->db_level,
 	    (u_longlong_t)db->db_blkid);
+}
 #endif
-}
 
 static int
 dmu_tx_try_assign(dmu_tx_t *tx, uint64_t txg_how, dmu_tx_hold_t **last_dth)
--- a/usr/src/uts/common/fs/zfs/dnode.c	Wed Nov 09 13:58:26 2005 -0800
+++ b/usr/src/uts/common/fs/zfs/dnode.c	Wed Nov 09 17:19:27 2005 -0800
@@ -113,10 +113,10 @@
 }
 
 
+#ifdef ZFS_DEBUG
 void
 dnode_verify(dnode_t *dn)
 {
-#ifdef ZFS_DEBUG
 	int drop_struct_lock = FALSE;
 
 	ASSERT(dn->dn_phys);
@@ -164,8 +164,8 @@
 	}
 	if (drop_struct_lock)
 		rw_exit(&dn->dn_struct_rwlock);
+}
 #endif
-}
 
 void
 dnode_byteswap(dnode_phys_t *dnp)
@@ -459,7 +459,7 @@
 dnode_special_open(objset_impl_t *os, dnode_phys_t *dnp, uint64_t object)
 {
 	dnode_t *dn = dnode_create(os, dnp, NULL, object);
-	dnode_verify(dn);
+	DNODE_VERIFY(dn);
 	return (dn);
 }
 
@@ -515,7 +515,7 @@
 
 	mdn = os->os_meta_dnode;
 
-	dnode_verify(mdn);
+	DNODE_VERIFY(mdn);
 
 	if (!RW_WRITE_HELD(&mdn->dn_struct_rwlock)) {
 		rw_enter(&mdn->dn_struct_rwlock, RW_READER);
@@ -570,7 +570,7 @@
 	if (refcount_add(&dn->dn_holds, ref) == 1)
 		dbuf_add_ref(db, dn);
 
-	dnode_verify(dn);
+	DNODE_VERIFY(dn);
 	ASSERT3P(dn->dn_dbuf, ==, db);
 	ASSERT3U(dn->dn_object, ==, object);
 	dbuf_rele(db);
@@ -614,7 +614,7 @@
 	if (IS_DNODE_DNODE(dn->dn_object))
 		return;
 
-	dnode_verify(dn);
+	DNODE_VERIFY(dn);
 
 #ifdef ZFS_DEBUG
 	mutex_enter(&dn->dn_mtx);
--- a/usr/src/uts/common/fs/zfs/dnode_sync.c	Wed Nov 09 13:58:26 2005 -0800
+++ b/usr/src/uts/common/fs/zfs/dnode_sync.c	Wed Nov 09 17:19:27 2005 -0800
@@ -36,7 +36,6 @@
 #include <sys/spa.h>
 #include <sys/zio.h>
 
-
 static void
 dnode_increase_indirection(dnode_t *dn, dmu_tx_t *tx)
 {
@@ -126,10 +125,10 @@
 	dnode_diduse_space(dn, -bytesfreed);
 }
 
+#ifdef ZFS_DEBUG
 static void
 free_verify(dmu_buf_impl_t *db, uint64_t start, uint64_t end, dmu_tx_t *tx)
 {
-#ifdef ZFS_DEBUG
 	int off, num;
 	int i, err, epbs;
 	uint64_t txg = tx->tx_txg;
@@ -197,8 +196,8 @@
 
 		dbuf_remove_ref(child, FTAG);
 	}
+}
 #endif
-}
 
 static int
 free_children(dmu_buf_impl_t *db, uint64_t blkid, uint64_t nblks, int trunc,
@@ -235,7 +234,7 @@
 	ASSERT3U(start, <=, end);
 
 	if (db->db_level == 1) {
-		free_verify(db, start, end, tx);
+		FREE_VERIFY(db, start, end, tx);
 		free_blocks(dn, bp, end-start+1, tx);
 		ASSERT(all || list_link_active(&db->db_dirty_node[txg_index]));
 		return (all);
@@ -423,7 +422,7 @@
 	    dn->dn_dirtyblksz[txgoff] > 0);
 
 	ASSERT(dnp->dn_type != DMU_OT_NONE || dn->dn_allocated_txg);
-	dnode_verify(dn);
+	DNODE_VERIFY(dn);
 	/*
 	 * Make sure the dbuf for the dn_phys is released before we modify it.
 	 */
--- a/usr/src/uts/common/fs/zfs/sys/dbuf.h	Wed Nov 09 13:58:26 2005 -0800
+++ b/usr/src/uts/common/fs/zfs/sys/dbuf.h	Wed Nov 09 17:19:27 2005 -0800
@@ -287,10 +287,13 @@
 	} \
 _NOTE(CONSTCOND) } while (0)
 
+#define	DBUF_VERIFY(db)	dbuf_verify(db)
+
 #else
 
 #define	dprintf_dbuf(db, fmt, ...)
 #define	dprintf_dbuf_bp(db, bp, fmt, ...)
+#define	DBUF_VERIFY(db)
 
 #endif
 
--- a/usr/src/uts/common/fs/zfs/sys/dmu_tx.h	Wed Nov 09 13:58:26 2005 -0800
+++ b/usr/src/uts/common/fs/zfs/sys/dmu_tx.h	Wed Nov 09 17:19:27 2005 -0800
@@ -141,9 +141,12 @@
 _NOTE(CONSTCOND) } while (0); \
 	else dprintf(fmt, __VA_ARGS__)
 
+#define	DMU_TX_DIRTY_BUF(tx, db)	dmu_tx_dirty_buf(tx, db)
+
 #else
 
 #define	dprintf_tx(tx, fmt, ...)
+#define	DMU_TX_DIRTY_BUF(tx, db)
 
 #endif
 
--- a/usr/src/uts/common/fs/zfs/sys/dnode.h	Wed Nov 09 13:58:26 2005 -0800
+++ b/usr/src/uts/common/fs/zfs/sys/dnode.h	Wed Nov 09 17:19:27 2005 -0800
@@ -288,9 +288,14 @@
 	} \
 _NOTE(CONSTCOND) } while (0)
 
+#define	DNODE_VERIFY(dn)		dnode_verify(dn)
+#define	FREE_VERIFY(db, start, end, tx)	free_verify(db, start, end, tx)
+
 #else
 
 #define	dprintf_dnode(db, fmt, ...)
+#define	DNODE_VERIFY(dn)
+#define	FREE_VERIFY(db, start, end, tx)
 
 #endif