Replace ASSERTV macro with compiler annotation

Remove the ASSERTV macro and handle suppressing unused 
compiler warnings for variables only in ASSERTs using the 
__attribute__((unused)) compiler annotation.  The annotation
is understood by both gcc and clang.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Jorgen Lundman <lundman@lundman.net>
Signed-off-by: Matt Macy <mmacy@FreeBSD.org>
Closes #9671
This commit is contained in:
Matthew Macy 2019-12-05 12:37:00 -08:00 committed by Brian Behlendorf
parent 12395c7b0b
commit 2a8ba608d3
28 changed files with 66 additions and 61 deletions

View File

@ -4664,7 +4664,7 @@ zdb_leak_fini(spa_t *spa, zdb_cb_t *zcb)
vdev_t *rvd = spa->spa_root_vdev; vdev_t *rvd = spa->spa_root_vdev;
for (unsigned c = 0; c < rvd->vdev_children; c++) { for (unsigned c = 0; c < rvd->vdev_children; c++) {
vdev_t *vd = rvd->vdev_child[c]; vdev_t *vd = rvd->vdev_child[c];
ASSERTV(metaslab_group_t *mg = vd->vdev_mg); metaslab_group_t *mg __maybe_unused = vd->vdev_mg;
if (zcb->zcb_vd_obsolete_counts[c] != NULL) { if (zcb->zcb_vd_obsolete_counts[c] != NULL) {
leaks |= zdb_check_for_obsolete_leaks(vd, zcb); leaks |= zdb_check_for_obsolete_leaks(vd, zcb);

View File

@ -3607,7 +3607,7 @@ ztest_device_removal(ztest_ds_t *zd, uint64_t id)
vdev_t * vdev_t *
grow_vdev(vdev_t *vd, void *arg) grow_vdev(vdev_t *vd, void *arg)
{ {
ASSERTV(spa_t *spa = vd->vdev_spa); spa_t *spa __maybe_unused = vd->vdev_spa;
size_t *newsize = arg; size_t *newsize = arg;
size_t fsize; size_t fsize;
int fd; int fd;

View File

@ -52,6 +52,10 @@
*/ */
#define __printflike(a, b) __printf(a, b) #define __printflike(a, b) __printf(a, b)
#ifndef __maybe_unused
#define __maybe_unused __attribute__((unused))
#endif
int spl_panic(const char *file, const char *func, int line, int spl_panic(const char *file, const char *func, int line,
const char *fmt, ...); const char *fmt, ...);
void spl_dumpstack(void); void spl_dumpstack(void);
@ -132,7 +136,6 @@ void spl_dumpstack(void);
#ifdef NDEBUG #ifdef NDEBUG
#define ASSERT(x) ((void)0) #define ASSERT(x) ((void)0)
#define ASSERTV(x)
#define ASSERT3B(x,y,z) ((void)0) #define ASSERT3B(x,y,z) ((void)0)
#define ASSERT3S(x,y,z) ((void)0) #define ASSERT3S(x,y,z) ((void)0)
#define ASSERT3U(x,y,z) ((void)0) #define ASSERT3U(x,y,z) ((void)0)
@ -152,7 +155,6 @@ void spl_dumpstack(void);
#define ASSERT3P VERIFY3P #define ASSERT3P VERIFY3P
#define ASSERT0 VERIFY0 #define ASSERT0 VERIFY0
#define ASSERT VERIFY #define ASSERT VERIFY
#define ASSERTV(x) x
#define IMPLY(A, B) \ #define IMPLY(A, B) \
((void)(((!(A)) || (B)) || \ ((void)(((!(A)) || (B)) || \
spl_panic(__FILE__, __FUNCTION__, __LINE__, \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \

View File

@ -145,7 +145,6 @@ do { \
#define ASSERT0(x) ((void)0) #define ASSERT0(x) ((void)0)
#define ASSERT(x) ((void)0) #define ASSERT(x) ((void)0)
#define assert(x) ((void)0) #define assert(x) ((void)0)
#define ASSERTV(x)
#define IMPLY(A, B) ((void)0) #define IMPLY(A, B) ((void)0)
#define EQUIV(A, B) ((void)0) #define EQUIV(A, B) ((void)0)
#else #else
@ -156,7 +155,6 @@ do { \
#define ASSERT0 VERIFY0 #define ASSERT0 VERIFY0
#define ASSERT VERIFY #define ASSERT VERIFY
#define assert VERIFY #define assert VERIFY
#define ASSERTV(x) x
#define IMPLY(A, B) \ #define IMPLY(A, B) \
((void)(((!(A)) || (B)) || \ ((void)(((!(A)) || (B)) || \
libspl_assert("(" #A ") implies (" #B ")", \ libspl_assert("(" #A ") implies (" #B ")", \

View File

@ -33,4 +33,8 @@
#define __printflike(x, y) __attribute__((__format__(__printf__, x, y))) #define __printflike(x, y) __attribute__((__format__(__printf__, x, y)))
#endif #endif
#ifndef __maybe_unused
#define __maybe_unused __attribute__((unused))
#endif
#endif #endif

View File

@ -708,7 +708,7 @@ zfs_write(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr)
#ifdef HAVE_UIO_ZEROCOPY #ifdef HAVE_UIO_ZEROCOPY
int i_iov = 0; int i_iov = 0;
const iovec_t *iovp = uio->uio_iov; const iovec_t *iovp = uio->uio_iov;
ASSERTV(int iovcnt = uio->uio_iovcnt); int iovcnt __maybe_unused = uio->uio_iovcnt;
#endif #endif

View File

@ -1080,7 +1080,7 @@ hdr_full_crypt_dest(void *vbuf, void *unused)
static void static void
hdr_l2only_dest(void *vbuf, void *unused) hdr_l2only_dest(void *vbuf, void *unused)
{ {
ASSERTV(arc_buf_hdr_t *hdr = vbuf); arc_buf_hdr_t *hdr __maybe_unused = vbuf;
ASSERT(HDR_EMPTY(hdr)); ASSERT(HDR_EMPTY(hdr));
arc_space_return(HDR_L2ONLY_SIZE, ARC_SPACE_L2HDRS); arc_space_return(HDR_L2ONLY_SIZE, ARC_SPACE_L2HDRS);

View File

@ -684,8 +684,8 @@ zfs_btree_insert_leaf_impl(zfs_btree_t *tree, zfs_btree_leaf_t *leaf,
uint64_t size = tree->bt_elem_size; uint64_t size = tree->bt_elem_size;
uint8_t *start = leaf->btl_elems + (idx * size); uint8_t *start = leaf->btl_elems + (idx * size);
zfs_btree_hdr_t *hdr = &leaf->btl_hdr; zfs_btree_hdr_t *hdr = &leaf->btl_hdr;
ASSERTV(uint64_t capacity = P2ALIGN((BTREE_LEAF_SIZE - uint64_t capacity __maybe_unused = P2ALIGN((BTREE_LEAF_SIZE -
sizeof (zfs_btree_hdr_t)) / size, 2)); sizeof (zfs_btree_hdr_t)) / size, 2);
uint64_t count = leaf->btl_hdr.bth_count - idx; uint64_t count = leaf->btl_hdr.bth_count - idx;
ASSERT3U(leaf->btl_hdr.bth_count, <, capacity); ASSERT3U(leaf->btl_hdr.bth_count, <, capacity);

View File

@ -986,8 +986,8 @@ dbuf_verify(dmu_buf_impl_t *db)
&dn->dn_phys->dn_blkptr[db->db_blkid]); &dn->dn_phys->dn_blkptr[db->db_blkid]);
} else { } else {
/* db is pointed to by an indirect block */ /* db is pointed to by an indirect block */
ASSERTV(int epb = db->db_parent->db.db_size >> int epb __maybe_unused = db->db_parent->db.db_size >>
SPA_BLKPTRSHIFT); SPA_BLKPTRSHIFT;
ASSERT3U(db->db_parent->db_level, ==, db->db_level+1); ASSERT3U(db->db_parent->db_level, ==, db->db_level+1);
ASSERT3U(db->db_parent->db.db_object, ==, ASSERT3U(db->db_parent->db.db_object, ==,
db->db.db_object); db->db.db_object);
@ -1881,7 +1881,7 @@ dbuf_new_size(dmu_buf_impl_t *db, int size, dmu_tx_t *tx)
void void
dbuf_release_bp(dmu_buf_impl_t *db) dbuf_release_bp(dmu_buf_impl_t *db)
{ {
ASSERTV(objset_t *os = db->db_objset); objset_t *os __maybe_unused = db->db_objset;
ASSERT(dsl_pool_sync_context(dmu_objset_pool(os))); ASSERT(dsl_pool_sync_context(dmu_objset_pool(os)));
ASSERT(arc_released(os->os_phys_buf) || ASSERT(arc_released(os->os_phys_buf) ||
@ -4345,8 +4345,8 @@ dbuf_write_done(zio_t *zio, arc_buf_t *buf, void *vdb)
ASSERT(list_head(&dr->dt.di.dr_children) == NULL); ASSERT(list_head(&dr->dt.di.dr_children) == NULL);
ASSERT3U(db->db.db_size, ==, 1 << dn->dn_phys->dn_indblkshift); ASSERT3U(db->db.db_size, ==, 1 << dn->dn_phys->dn_indblkshift);
if (!BP_IS_HOLE(db->db_blkptr)) { if (!BP_IS_HOLE(db->db_blkptr)) {
ASSERTV(int epbs = dn->dn_phys->dn_indblkshift - int epbs __maybe_unused = dn->dn_phys->dn_indblkshift -
SPA_BLKPTRSHIFT); SPA_BLKPTRSHIFT;
ASSERT3U(db->db_blkid, <=, ASSERT3U(db->db_blkid, <=,
dn->dn_phys->dn_maxblkid >> (db->db_level * epbs)); dn->dn_phys->dn_maxblkid >> (db->db_level * epbs));
ASSERT3U(BP_GET_LSIZE(db->db_blkptr), ==, ASSERT3U(BP_GET_LSIZE(db->db_blkptr), ==,

View File

@ -1768,7 +1768,7 @@ dmu_sync_late_arrival_done(zio_t *zio)
zil_lwb_add_block(zgd->zgd_lwb, zgd->zgd_bp); zil_lwb_add_block(zgd->zgd_lwb, zgd->zgd_bp);
if (!BP_IS_HOLE(bp)) { if (!BP_IS_HOLE(bp)) {
ASSERTV(blkptr_t *bp_orig = &zio->io_bp_orig); blkptr_t *bp_orig __maybe_unused = &zio->io_bp_orig;
ASSERT(!(zio->io_flags & ZIO_FLAG_NOPWRITE)); ASSERT(!(zio->io_flags & ZIO_FLAG_NOPWRITE));
ASSERT(BP_IS_HOLE(bp_orig) || !BP_EQUAL(bp, bp_orig)); ASSERT(BP_IS_HOLE(bp_orig) || !BP_EQUAL(bp, bp_orig));
ASSERT(zio->io_bp->blk_birth == zio->io_txg); ASSERT(zio->io_bp->blk_birth == zio->io_txg);

View File

@ -74,7 +74,7 @@ dnode_stats_t dnode_stats = {
static kstat_t *dnode_ksp; static kstat_t *dnode_ksp;
static kmem_cache_t *dnode_cache; static kmem_cache_t *dnode_cache;
ASSERTV(static dnode_phys_t dnode_phys_zero); static dnode_phys_t dnode_phys_zero __maybe_unused;
int zfs_default_bs = SPA_MINBLOCKSHIFT; int zfs_default_bs = SPA_MINBLOCKSHIFT;
int zfs_default_ibs = DN_MAX_INDBLKSHIFT; int zfs_default_ibs = DN_MAX_INDBLKSHIFT;

View File

@ -422,11 +422,11 @@ dnode_sync_free_range_impl(dnode_t *dn, uint64_t blkid, uint64_t nblks,
* match. * match.
*/ */
if (trunc && !dn->dn_objset->os_raw_receive) { if (trunc && !dn->dn_objset->os_raw_receive) {
ASSERTV(uint64_t off); uint64_t off __maybe_unused;
dn->dn_phys->dn_maxblkid = blkid == 0 ? 0 : blkid - 1; dn->dn_phys->dn_maxblkid = blkid == 0 ? 0 : blkid - 1;
ASSERTV(off = (dn->dn_phys->dn_maxblkid + 1) * off = (dn->dn_phys->dn_maxblkid + 1) *
(dn->dn_phys->dn_datablkszsec << SPA_MINBLOCKSHIFT)); (dn->dn_phys->dn_datablkszsec << SPA_MINBLOCKSHIFT);
ASSERT(off < dn->dn_phys->dn_maxblkid || ASSERT(off < dn->dn_phys->dn_maxblkid ||
dn->dn_phys->dn_maxblkid == 0 || dn->dn_phys->dn_maxblkid == 0 ||
dnode_next_offset(dn, 0, &off, 1, 1, 0) != 0); dnode_next_offset(dn, 0, &off, 1, 1, 0) != 0);
@ -628,7 +628,7 @@ dnode_sync(dnode_t *dn, dmu_tx_t *tx)
dnode_phys_t *dnp = dn->dn_phys; dnode_phys_t *dnp = dn->dn_phys;
int txgoff = tx->tx_txg & TXG_MASK; int txgoff = tx->tx_txg & TXG_MASK;
list_t *list = &dn->dn_dirty_records[txgoff]; list_t *list = &dn->dn_dirty_records[txgoff];
ASSERTV(static const dnode_phys_t zerodn = { 0 }); static const dnode_phys_t zerodn __maybe_unused = { 0 };
boolean_t kill_spill = B_FALSE; boolean_t kill_spill = B_FALSE;
ASSERT(dmu_tx_is_syncing(tx)); ASSERT(dmu_tx_is_syncing(tx));

View File

@ -1366,7 +1366,7 @@ dsl_dataset_remove_from_next_clones(dsl_dataset_t *ds, uint64_t obj,
dmu_tx_t *tx) dmu_tx_t *tx)
{ {
objset_t *mos = ds->ds_dir->dd_pool->dp_meta_objset; objset_t *mos = ds->ds_dir->dd_pool->dp_meta_objset;
ASSERTV(uint64_t count); uint64_t count __maybe_unused;
int err; int err;
ASSERT(dsl_dataset_phys(ds)->ds_num_children >= 2); ASSERT(dsl_dataset_phys(ds)->ds_num_children >= 2);
@ -1674,8 +1674,8 @@ dsl_dataset_snapshot_sync_impl(dsl_dataset_t *ds, const char *snapname,
dsl_dataset_phys_t *dsphys; dsl_dataset_phys_t *dsphys;
uint64_t dsobj, crtxg; uint64_t dsobj, crtxg;
objset_t *mos = dp->dp_meta_objset; objset_t *mos = dp->dp_meta_objset;
ASSERTV(static zil_header_t zero_zil); static zil_header_t zero_zil __maybe_unused;
ASSERTV(objset_t *os); objset_t *os __maybe_unused;
ASSERT(RRW_WRITE_HELD(&dp->dp_config_rwlock)); ASSERT(RRW_WRITE_HELD(&dp->dp_config_rwlock));
@ -2843,7 +2843,7 @@ dsl_dataset_stats(dsl_dataset_t *ds, nvlist_t *nv)
void void
dsl_dataset_fast_stat(dsl_dataset_t *ds, dmu_objset_stats_t *stat) dsl_dataset_fast_stat(dsl_dataset_t *ds, dmu_objset_stats_t *stat)
{ {
ASSERTV(dsl_pool_t *dp = ds->ds_dir->dd_pool); dsl_pool_t *dp __maybe_unused = ds->ds_dir->dd_pool;
ASSERT(dsl_pool_config_held(dp)); ASSERT(dsl_pool_config_held(dp));
stat->dds_creation_txg = dsl_get_creationtxg(ds); stat->dds_creation_txg = dsl_get_creationtxg(ds);
@ -2899,7 +2899,7 @@ dsl_dataset_space(dsl_dataset_t *ds,
boolean_t boolean_t
dsl_dataset_modified_since_snap(dsl_dataset_t *ds, dsl_dataset_t *snap) dsl_dataset_modified_since_snap(dsl_dataset_t *ds, dsl_dataset_t *snap)
{ {
ASSERTV(dsl_pool_t *dp = ds->ds_dir->dd_pool); dsl_pool_t *dp __maybe_unused = ds->ds_dir->dd_pool;
uint64_t birth; uint64_t birth;
ASSERT(dsl_pool_config_held(dp)); ASSERT(dsl_pool_config_held(dp));

View File

@ -540,7 +540,7 @@ dsl_destroy_snapshot_sync_impl(dsl_dataset_t *ds, boolean_t defer, dmu_tx_t *tx)
spa_prop_clear_bootfs(dp->dp_spa, ds->ds_object, tx); spa_prop_clear_bootfs(dp->dp_spa, ds->ds_object, tx);
if (dsl_dataset_phys(ds)->ds_next_clones_obj != 0) { if (dsl_dataset_phys(ds)->ds_next_clones_obj != 0) {
ASSERTV(uint64_t count); uint64_t count __maybe_unused;
ASSERT0(zap_count(mos, ASSERT0(zap_count(mos,
dsl_dataset_phys(ds)->ds_next_clones_obj, &count) && dsl_dataset_phys(ds)->ds_next_clones_obj, &count) &&
count == 0); count == 0);

View File

@ -141,7 +141,7 @@ dsl_dir_evict_async(void *dbu)
{ {
dsl_dir_t *dd = dbu; dsl_dir_t *dd = dbu;
int t; int t;
ASSERTV(dsl_pool_t *dp = dd->dd_pool); dsl_pool_t *dp __maybe_unused = dd->dd_pool;
dd->dd_dbuf = NULL; dd->dd_dbuf = NULL;

View File

@ -283,7 +283,7 @@ dsl_prop_register(dsl_dataset_t *ds, const char *propname,
dsl_prop_record_t *pr; dsl_prop_record_t *pr;
dsl_prop_cb_record_t *cbr; dsl_prop_cb_record_t *cbr;
int err; int err;
ASSERTV(dsl_pool_t *dp = dd->dd_pool); dsl_pool_t *dp __maybe_unused = dd->dd_pool;
ASSERT(dsl_pool_config_held(dp)); ASSERT(dsl_pool_config_held(dp));

View File

@ -3354,7 +3354,7 @@ metaslab_passivate_allocator(metaslab_group_t *mg, metaslab_t *msp,
static void static void
metaslab_passivate(metaslab_t *msp, uint64_t weight) metaslab_passivate(metaslab_t *msp, uint64_t weight)
{ {
ASSERTV(uint64_t size = weight & ~METASLAB_WEIGHT_TYPE); uint64_t size __maybe_unused = weight & ~METASLAB_WEIGHT_TYPE;
/* /*
* If size < SPA_MINBLOCKSIZE, then we will not allocate from * If size < SPA_MINBLOCKSIZE, then we will not allocate from
@ -5959,7 +5959,7 @@ static void
metaslab_check_free_impl(vdev_t *vd, uint64_t offset, uint64_t size) metaslab_check_free_impl(vdev_t *vd, uint64_t offset, uint64_t size)
{ {
metaslab_t *msp; metaslab_t *msp;
ASSERTV(spa_t *spa = vd->vdev_spa); spa_t *spa __maybe_unused = vd->vdev_spa;
if ((zfs_flags & ZFS_DEBUG_ZIO_FREE) == 0) if ((zfs_flags & ZFS_DEBUG_ZIO_FREE) == 0)
return; return;

View File

@ -1237,7 +1237,7 @@ sa_byteswap(sa_handle_t *hdl, sa_buf_type_t buftype)
dmu_buf_impl_t *db; dmu_buf_impl_t *db;
int num_lengths = 1; int num_lengths = 1;
int i; int i;
ASSERTV(sa_os_t *sa = hdl->sa_os->os_sa); sa_os_t *sa __maybe_unused = hdl->sa_os->os_sa;
ASSERT(MUTEX_HELD(&sa->sa_lock)); ASSERT(MUTEX_HELD(&sa->sa_lock));
if (sa_hdr_phys->sa_magic == SA_MAGIC) if (sa_hdr_phys->sa_magic == SA_MAGIC)
@ -1344,7 +1344,7 @@ sa_idx_tab_rele(objset_t *os, void *arg)
static void static void
sa_idx_tab_hold(objset_t *os, sa_idx_tab_t *idx_tab) sa_idx_tab_hold(objset_t *os, sa_idx_tab_t *idx_tab)
{ {
ASSERTV(sa_os_t *sa = os->os_sa); sa_os_t *sa __maybe_unused = os->os_sa;
ASSERT(MUTEX_HELD(&sa->sa_lock)); ASSERT(MUTEX_HELD(&sa->sa_lock));
(void) zfs_refcount_add(&idx_tab->sa_refcount, NULL); (void) zfs_refcount_add(&idx_tab->sa_refcount, NULL);

View File

@ -847,7 +847,7 @@ spa_prop_clear_bootfs(spa_t *spa, uint64_t dsobj, dmu_tx_t *tx)
static int static int
spa_change_guid_check(void *arg, dmu_tx_t *tx) spa_change_guid_check(void *arg, dmu_tx_t *tx)
{ {
ASSERTV(uint64_t *newguid = arg); uint64_t *newguid __maybe_unused = arg;
spa_t *spa = dmu_tx_pool(tx)->dp_spa; spa_t *spa = dmu_tx_pool(tx)->dp_spa;
vdev_t *rvd = spa->spa_root_vdev; vdev_t *rvd = spa->spa_root_vdev;
uint64_t vdev_state; uint64_t vdev_state;
@ -6530,7 +6530,7 @@ int
spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *nvroot, int replacing) spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *nvroot, int replacing)
{ {
uint64_t txg, dtl_max_txg; uint64_t txg, dtl_max_txg;
ASSERTV(vdev_t *rvd = spa->spa_root_vdev); vdev_t *rvd __maybe_unused = spa->spa_root_vdev;
vdev_t *oldvd, *newvd, *newrootvd, *pvd, *tvd; vdev_t *oldvd, *newvd, *newrootvd, *pvd, *tvd;
vdev_ops_t *pvops; vdev_ops_t *pvops;
char *oldvdpath, *newvdpath; char *oldvdpath, *newvdpath;
@ -6755,7 +6755,7 @@ spa_vdev_detach(spa_t *spa, uint64_t guid, uint64_t pguid, int replace_done)
{ {
uint64_t txg; uint64_t txg;
int error; int error;
ASSERTV(vdev_t *rvd = spa->spa_root_vdev); vdev_t *rvd __maybe_unused = spa->spa_root_vdev;
vdev_t *vd, *pvd, *cvd, *tvd; vdev_t *vd, *pvd, *cvd, *tvd;
boolean_t unspare = B_FALSE; boolean_t unspare = B_FALSE;
uint64_t unspare_guid = 0; uint64_t unspare_guid = 0;
@ -8640,8 +8640,8 @@ spa_sync_upgrades(spa_t *spa, dmu_tx_t *tx)
static void static void
vdev_indirect_state_sync_verify(vdev_t *vd) vdev_indirect_state_sync_verify(vdev_t *vd)
{ {
ASSERTV(vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping); vdev_indirect_mapping_t *vim __maybe_unused = vd->vdev_indirect_mapping;
ASSERTV(vdev_indirect_births_t *vib = vd->vdev_indirect_births); vdev_indirect_births_t *vib __maybe_unused = vd->vdev_indirect_births;
if (vd->vdev_ops == &vdev_indirect_ops) { if (vd->vdev_ops == &vdev_indirect_ops) {
ASSERT(vim != NULL); ASSERT(vim != NULL);

View File

@ -813,7 +813,7 @@ txg_sync_waiting(dsl_pool_t *dp)
void void
txg_verify(spa_t *spa, uint64_t txg) txg_verify(spa_t *spa, uint64_t txg)
{ {
ASSERTV(dsl_pool_t *dp = spa_get_dsl(spa)); dsl_pool_t *dp __maybe_unused = spa_get_dsl(spa);
if (txg <= TXG_INITIAL || txg == ZILTEST_TXG) if (txg <= TXG_INITIAL || txg == ZILTEST_TXG)
return; return;
ASSERT3U(txg, <=, dp->dp_tx.tx_open_txg); ASSERT3U(txg, <=, dp->dp_tx.tx_open_txg);

View File

@ -2197,7 +2197,7 @@ void
vdev_close(vdev_t *vd) vdev_close(vdev_t *vd)
{ {
vdev_t *pvd = vd->vdev_parent; vdev_t *pvd = vd->vdev_parent;
ASSERTV(spa_t *spa = vd->vdev_spa); spa_t *spa __maybe_unused = vd->vdev_spa;
ASSERT(spa_config_held(spa, SCL_STATE_ALL, RW_WRITER) == SCL_STATE_ALL); ASSERT(spa_config_held(spa, SCL_STATE_ALL, RW_WRITER) == SCL_STATE_ALL);

View File

@ -254,7 +254,7 @@ vdev_cache_read(zio_t *zio)
vdev_cache_entry_t *ve, *ve_search; vdev_cache_entry_t *ve, *ve_search;
uint64_t cache_offset = P2ALIGN(zio->io_offset, VCBS); uint64_t cache_offset = P2ALIGN(zio->io_offset, VCBS);
zio_t *fio; zio_t *fio;
ASSERTV(uint64_t cache_phase = P2PHASE(zio->io_offset, VCBS)); uint64_t cache_phase __maybe_unused = P2PHASE(zio->io_offset, VCBS);
ASSERT3U(zio->io_type, ==, ZIO_TYPE_READ); ASSERT3U(zio->io_type, ==, ZIO_TYPE_READ);

View File

@ -421,7 +421,7 @@ vdev_indirect_should_condense(vdev_t *vd)
* If nothing new has been marked obsolete, there is no * If nothing new has been marked obsolete, there is no
* point in condensing. * point in condensing.
*/ */
ASSERTV(uint64_t obsolete_sm_obj); uint64_t obsolete_sm_obj __maybe_unused;
ASSERT0(vdev_obsolete_sm_object(vd, &obsolete_sm_obj)); ASSERT0(vdev_obsolete_sm_object(vd, &obsolete_sm_obj));
if (vd->vdev_obsolete_sm == NULL) { if (vd->vdev_obsolete_sm == NULL) {
ASSERT0(obsolete_sm_obj); ASSERT0(obsolete_sm_obj);
@ -544,7 +544,7 @@ spa_condense_indirect_commit_sync(void *arg, dmu_tx_t *tx)
{ {
spa_condensing_indirect_t *sci = arg; spa_condensing_indirect_t *sci = arg;
uint64_t txg = dmu_tx_get_txg(tx); uint64_t txg = dmu_tx_get_txg(tx);
ASSERTV(spa_t *spa = dmu_tx_pool(tx)->dp_spa); spa_t *spa __maybe_unused = dmu_tx_pool(tx)->dp_spa;
ASSERT(dmu_tx_is_syncing(tx)); ASSERT(dmu_tx_is_syncing(tx));
ASSERT3P(sci, ==, spa->spa_condensing_indirect); ASSERT3P(sci, ==, spa->spa_condensing_indirect);
@ -815,7 +815,7 @@ void
vdev_indirect_sync_obsolete(vdev_t *vd, dmu_tx_t *tx) vdev_indirect_sync_obsolete(vdev_t *vd, dmu_tx_t *tx)
{ {
spa_t *spa = vd->vdev_spa; spa_t *spa = vd->vdev_spa;
ASSERTV(vdev_indirect_config_t *vic = &vd->vdev_indirect_config); vdev_indirect_config_t *vic __maybe_unused = &vd->vdev_indirect_config;
ASSERT3U(vic->vic_mapping_object, !=, 0); ASSERT3U(vic->vic_mapping_object, !=, 0);
ASSERT(range_tree_space(vd->vdev_obsolete_segments) > 0); ASSERT(range_tree_space(vd->vdev_obsolete_segments) > 0);
@ -1298,7 +1298,7 @@ vdev_indirect_read_all(zio_t *zio)
static void static void
vdev_indirect_io_start(zio_t *zio) vdev_indirect_io_start(zio_t *zio)
{ {
ASSERTV(spa_t *spa = zio->io_spa); spa_t *spa __maybe_unused = zio->io_spa;
indirect_vsd_t *iv = kmem_zalloc(sizeof (*iv), KM_SLEEP); indirect_vsd_t *iv = kmem_zalloc(sizeof (*iv), KM_SLEEP);
list_create(&iv->iv_splits, list_create(&iv->iv_splits,
sizeof (indirect_split_t), offsetof(indirect_split_t, is_node)); sizeof (indirect_split_t), offsetof(indirect_split_t, is_node));

View File

@ -39,11 +39,12 @@ vdev_indirect_mapping_verify(vdev_indirect_mapping_t *vim)
EQUIV(vim->vim_phys->vimp_num_entries > 0, EQUIV(vim->vim_phys->vimp_num_entries > 0,
vim->vim_entries != NULL); vim->vim_entries != NULL);
if (vim->vim_phys->vimp_num_entries > 0) { if (vim->vim_phys->vimp_num_entries > 0) {
ASSERTV(vdev_indirect_mapping_entry_phys_t *last_entry = vdev_indirect_mapping_entry_phys_t *last_entry __maybe_unused =
&vim->vim_entries[vim->vim_phys->vimp_num_entries - 1]); &vim->vim_entries[vim->vim_phys->vimp_num_entries - 1];
ASSERTV(uint64_t offset = uint64_t offset __maybe_unused =
DVA_MAPPING_GET_SRC_OFFSET(last_entry)); DVA_MAPPING_GET_SRC_OFFSET(last_entry);
ASSERTV(uint64_t size = DVA_GET_ASIZE(&last_entry->vimep_dst)); uint64_t size __maybe_unused =
DVA_GET_ASIZE(&last_entry->vimep_dst);
ASSERT3U(vim->vim_phys->vimp_max_offset, >=, offset + size); ASSERT3U(vim->vim_phys->vimp_max_offset, >=, offset + size);
} }

View File

@ -248,7 +248,7 @@ vdev_remove_initiate_sync(void *arg, dmu_tx_t *tx)
vdev_indirect_config_t *vic = &vd->vdev_indirect_config; vdev_indirect_config_t *vic = &vd->vdev_indirect_config;
objset_t *mos = spa->spa_dsl_pool->dp_meta_objset; objset_t *mos = spa->spa_dsl_pool->dp_meta_objset;
spa_vdev_removal_t *svr = NULL; spa_vdev_removal_t *svr = NULL;
ASSERTV(uint64_t txg = dmu_tx_get_txg(tx)); uint64_t txg __maybe_unused = dmu_tx_get_txg(tx);
ASSERT3P(vd->vdev_ops, !=, &vdev_raidz_ops); ASSERT3P(vd->vdev_ops, !=, &vdev_raidz_ops);
svr = spa_vdev_removal_create(vd); svr = spa_vdev_removal_create(vd);
@ -268,7 +268,7 @@ vdev_remove_initiate_sync(void *arg, dmu_tx_t *tx)
VERIFY0(zap_add(spa->spa_meta_objset, vd->vdev_top_zap, VERIFY0(zap_add(spa->spa_meta_objset, vd->vdev_top_zap,
VDEV_TOP_ZAP_OBSOLETE_COUNTS_ARE_PRECISE, sizeof (one), 1, VDEV_TOP_ZAP_OBSOLETE_COUNTS_ARE_PRECISE, sizeof (one), 1,
&one, tx)); &one, tx));
ASSERTV(boolean_t are_precise); boolean_t are_precise __maybe_unused;
ASSERT0(vdev_obsolete_counts_are_precise(vd, &are_precise)); ASSERT0(vdev_obsolete_counts_are_precise(vd, &are_precise));
ASSERT3B(are_precise, ==, B_TRUE); ASSERT3B(are_precise, ==, B_TRUE);
} }
@ -725,7 +725,7 @@ vdev_mapping_sync(void *arg, dmu_tx_t *tx)
spa_vdev_removal_t *svr = arg; spa_vdev_removal_t *svr = arg;
spa_t *spa = dmu_tx_pool(tx)->dp_spa; spa_t *spa = dmu_tx_pool(tx)->dp_spa;
vdev_t *vd = vdev_lookup_top(spa, svr->svr_vdev_id); vdev_t *vd = vdev_lookup_top(spa, svr->svr_vdev_id);
ASSERTV(vdev_indirect_config_t *vic = &vd->vdev_indirect_config); vdev_indirect_config_t *vic __maybe_unused = &vd->vdev_indirect_config;
uint64_t txg = dmu_tx_get_txg(tx); uint64_t txg = dmu_tx_get_txg(tx);
vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping; vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping;

View File

@ -279,7 +279,7 @@ feature_get_refcount_from_disk(spa_t *spa, zfeature_info_t *feature,
static int static int
feature_get_enabled_txg(spa_t *spa, zfeature_info_t *feature, uint64_t *res) feature_get_enabled_txg(spa_t *spa, zfeature_info_t *feature, uint64_t *res)
{ {
ASSERTV(uint64_t enabled_txg_obj = spa->spa_feat_enabled_txg_obj); uint64_t enabled_txg_obj __maybe_unused = spa->spa_feat_enabled_txg_obj;
ASSERT(zfeature_depends_on(feature->fi_feature, ASSERT(zfeature_depends_on(feature->fi_feature,
SPA_FEATURE_ENABLED_TXG)); SPA_FEATURE_ENABLED_TXG));
@ -397,9 +397,9 @@ feature_do_action(spa_t *spa, spa_feature_t fid, feature_action_t action,
{ {
uint64_t refcount = 0; uint64_t refcount = 0;
zfeature_info_t *feature = &spa_feature_table[fid]; zfeature_info_t *feature = &spa_feature_table[fid];
ASSERTV(uint64_t zapobj = uint64_t zapobj __maybe_unused =
(feature->fi_flags & ZFEATURE_FLAG_READONLY_COMPAT) ? (feature->fi_flags & ZFEATURE_FLAG_READONLY_COMPAT) ?
spa->spa_feat_for_write_obj : spa->spa_feat_for_read_obj); spa->spa_feat_for_write_obj : spa->spa_feat_for_read_obj;
ASSERT(VALID_FEATURE_FID(fid)); ASSERT(VALID_FEATURE_FID(fid));
ASSERT(0 != zapobj); ASSERT(0 != zapobj);

View File

@ -2550,7 +2550,7 @@ zio_write_gang_member_ready(zio_t *zio)
dva_t *cdva = zio->io_bp->blk_dva; dva_t *cdva = zio->io_bp->blk_dva;
dva_t *pdva = pio->io_bp->blk_dva; dva_t *pdva = pio->io_bp->blk_dva;
uint64_t asize; uint64_t asize;
ASSERTV(zio_t *gio = zio->io_gang_leader); zio_t *gio __maybe_unused = zio->io_gang_leader;
if (BP_IS_HOLE(zio->io_bp)) if (BP_IS_HOLE(zio->io_bp))
return; return;
@ -4184,7 +4184,7 @@ zio_ready(zio_t *zio)
static void static void
zio_dva_throttle_done(zio_t *zio) zio_dva_throttle_done(zio_t *zio)
{ {
ASSERTV(zio_t *lio = zio->io_logical); zio_t *lio __maybe_unused = zio->io_logical;
zio_t *pio = zio_unique_parent(zio); zio_t *pio = zio_unique_parent(zio);
vdev_t *vd = zio->io_vd; vdev_t *vd = zio->io_vd;
int flags = METASLAB_ASYNC_ALLOC; int flags = METASLAB_ASYNC_ALLOC;

View File

@ -339,7 +339,7 @@ zio_handle_label_injection(zio_t *zio, int error)
static int static int
zio_inject_bitflip_cb(void *data, size_t len, void *private) zio_inject_bitflip_cb(void *data, size_t len, void *private)
{ {
ASSERTV(zio_t *zio = private); zio_t *zio __maybe_unused = private;
uint8_t *buffer = data; uint8_t *buffer = data;
uint_t byte = spa_get_random(len); uint_t byte = spa_get_random(len);