From 949f89290996e437e24fce791ef2c2398c6b47d7 Mon Sep 17 00:00:00 2001 From: Matthew Macy Date: Wed, 4 Dec 2019 12:39:24 -0800 Subject: [PATCH] Replace ASSERTV macro with compiler annotation Signed-off-by: Matt Macy --- cmd/zdb/zdb.c | 2 +- cmd/ztest/ztest.c | 2 +- include/os/linux/spl/sys/debug.h | 6 ++++-- lib/libspl/include/assert.h | 2 -- lib/libspl/include/sys/debug.h | 4 ++++ module/os/linux/zfs/zfs_vnops.c | 6 +++--- module/zfs/arc.c | 2 +- module/zfs/btree.c | 4 ++-- module/zfs/dbuf.c | 10 +++++----- module/zfs/dmu.c | 2 +- module/zfs/dnode.c | 2 +- module/zfs/dnode_sync.c | 8 ++++---- module/zfs/dsl_dataset.c | 10 +++++----- module/zfs/dsl_destroy.c | 2 +- module/zfs/dsl_dir.c | 2 +- module/zfs/dsl_prop.c | 2 +- module/zfs/metaslab.c | 4 ++-- module/zfs/sa.c | 4 ++-- module/zfs/spa.c | 10 +++++----- module/zfs/txg.c | 2 +- module/zfs/vdev.c | 2 +- module/zfs/vdev_cache.c | 2 +- module/zfs/vdev_indirect.c | 8 ++++---- module/zfs/vdev_indirect_mapping.c | 11 ++++++----- module/zfs/vdev_removal.c | 6 +++--- module/zfs/zfeature.c | 6 +++--- module/zfs/zio.c | 4 ++-- module/zfs/zio_inject.c | 2 +- 28 files changed, 66 insertions(+), 61 deletions(-) diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c index 3cdd7f2c15f9..e4c8861ebe61 100644 --- a/cmd/zdb/zdb.c +++ b/cmd/zdb/zdb.c @@ -4664,7 +4664,7 @@ zdb_leak_fini(spa_t *spa, zdb_cb_t *zcb) vdev_t *rvd = spa->spa_root_vdev; for (unsigned c = 0; c < rvd->vdev_children; 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) { leaks |= zdb_check_for_obsolete_leaks(vd, zcb); diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c index dbc5084d07e1..e4b0f61f8881 100644 --- a/cmd/ztest/ztest.c +++ b/cmd/ztest/ztest.c @@ -3607,7 +3607,7 @@ ztest_device_removal(ztest_ds_t *zd, uint64_t id) vdev_t * 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 fsize; int fd; diff --git a/include/os/linux/spl/sys/debug.h b/include/os/linux/spl/sys/debug.h index 8fad3bef6d7a..ed085fe8af82 100644 --- a/include/os/linux/spl/sys/debug.h +++ b/include/os/linux/spl/sys/debug.h @@ -52,6 +52,10 @@ */ #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, const char *fmt, ...); void spl_dumpstack(void); @@ -132,7 +136,6 @@ void spl_dumpstack(void); #ifdef NDEBUG #define ASSERT(x) ((void)0) -#define ASSERTV(x) #define ASSERT3B(x,y,z) ((void)0) #define ASSERT3S(x,y,z) ((void)0) #define ASSERT3U(x,y,z) ((void)0) @@ -152,7 +155,6 @@ void spl_dumpstack(void); #define ASSERT3P VERIFY3P #define ASSERT0 VERIFY0 #define ASSERT VERIFY -#define ASSERTV(x) x #define IMPLY(A, B) \ ((void)(((!(A)) || (B)) || \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ diff --git a/lib/libspl/include/assert.h b/lib/libspl/include/assert.h index b7b406850f7a..19b25f7dd825 100644 --- a/lib/libspl/include/assert.h +++ b/lib/libspl/include/assert.h @@ -145,7 +145,6 @@ do { \ #define ASSERT0(x) ((void)0) #define ASSERT(x) ((void)0) #define assert(x) ((void)0) -#define ASSERTV(x) #define IMPLY(A, B) ((void)0) #define EQUIV(A, B) ((void)0) #else @@ -156,7 +155,6 @@ do { \ #define ASSERT0 VERIFY0 #define ASSERT VERIFY #define assert VERIFY -#define ASSERTV(x) x #define IMPLY(A, B) \ ((void)(((!(A)) || (B)) || \ libspl_assert("(" #A ") implies (" #B ")", \ diff --git a/lib/libspl/include/sys/debug.h b/lib/libspl/include/sys/debug.h index c6a8c6784c66..af18da94804c 100644 --- a/lib/libspl/include/sys/debug.h +++ b/lib/libspl/include/sys/debug.h @@ -33,4 +33,8 @@ #define __printflike(x, y) __attribute__((__format__(__printf__, x, y))) #endif +#ifndef __maybe_unused +#define __maybe_unused __attribute__((unused)) +#endif + #endif diff --git a/module/os/linux/zfs/zfs_vnops.c b/module/os/linux/zfs/zfs_vnops.c index e7d0e8933f2f..d5a94831655d 100644 --- a/module/os/linux/zfs/zfs_vnops.c +++ b/module/os/linux/zfs/zfs_vnops.c @@ -706,9 +706,9 @@ zfs_write(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr) uint64_t end_size = MAX(zp->z_size, woff + n); zilog_t *zilog = zfsvfs->z_log; #ifdef HAVE_UIO_ZEROCOPY - int i_iov = 0; - const iovec_t *iovp = uio->uio_iov; - ASSERTV(int iovcnt = uio->uio_iovcnt); + int i_iov = 0; + const iovec_t *iovp = uio->uio_iov; + int iovcnt __maybe_unused = uio->uio_iovcnt; #endif diff --git a/module/zfs/arc.c b/module/zfs/arc.c index 2ca4b6bef5a4..8fa8c91ac49c 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -1080,7 +1080,7 @@ hdr_full_crypt_dest(void *vbuf, void *unused) static void 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)); arc_space_return(HDR_L2ONLY_SIZE, ARC_SPACE_L2HDRS); diff --git a/module/zfs/btree.c b/module/zfs/btree.c index 9f69d4b1aebe..da1886a5764c 100644 --- a/module/zfs/btree.c +++ b/module/zfs/btree.c @@ -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; uint8_t *start = leaf->btl_elems + (idx * size); zfs_btree_hdr_t *hdr = &leaf->btl_hdr; - ASSERTV(uint64_t capacity = P2ALIGN((BTREE_LEAF_SIZE - - sizeof (zfs_btree_hdr_t)) / size, 2)); + uint64_t capacity __maybe_unused = P2ALIGN((BTREE_LEAF_SIZE - + sizeof (zfs_btree_hdr_t)) / size, 2); uint64_t count = leaf->btl_hdr.bth_count - idx; ASSERT3U(leaf->btl_hdr.bth_count, <, capacity); diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c index 9c1132cfbd38..d460f9922a21 100644 --- a/module/zfs/dbuf.c +++ b/module/zfs/dbuf.c @@ -986,8 +986,8 @@ dbuf_verify(dmu_buf_impl_t *db) &dn->dn_phys->dn_blkptr[db->db_blkid]); } else { /* db is pointed to by an indirect block */ - ASSERTV(int epb = db->db_parent->db.db_size >> - SPA_BLKPTRSHIFT); + int epb __maybe_unused = db->db_parent->db.db_size >> + SPA_BLKPTRSHIFT; ASSERT3U(db->db_parent->db_level, ==, db->db_level+1); ASSERT3U(db->db_parent->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 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(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); ASSERT3U(db->db.db_size, ==, 1 << dn->dn_phys->dn_indblkshift); if (!BP_IS_HOLE(db->db_blkptr)) { - ASSERTV(int epbs = dn->dn_phys->dn_indblkshift - - SPA_BLKPTRSHIFT); + int epbs __maybe_unused = dn->dn_phys->dn_indblkshift - + SPA_BLKPTRSHIFT; ASSERT3U(db->db_blkid, <=, dn->dn_phys->dn_maxblkid >> (db->db_level * epbs)); ASSERT3U(BP_GET_LSIZE(db->db_blkptr), ==, diff --git a/module/zfs/dmu.c b/module/zfs/dmu.c index f34429eee8a3..b7fe0f5c0d88 100644 --- a/module/zfs/dmu.c +++ b/module/zfs/dmu.c @@ -1768,7 +1768,7 @@ dmu_sync_late_arrival_done(zio_t *zio) zil_lwb_add_block(zgd->zgd_lwb, zgd->zgd_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(BP_IS_HOLE(bp_orig) || !BP_EQUAL(bp, bp_orig)); ASSERT(zio->io_bp->blk_birth == zio->io_txg); diff --git a/module/zfs/dnode.c b/module/zfs/dnode.c index 343aadbedbbf..7a48d4014f39 100644 --- a/module/zfs/dnode.c +++ b/module/zfs/dnode.c @@ -74,7 +74,7 @@ dnode_stats_t dnode_stats = { static kstat_t *dnode_ksp; 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_ibs = DN_MAX_INDBLKSHIFT; diff --git a/module/zfs/dnode_sync.c b/module/zfs/dnode_sync.c index 4e002d326a90..5df395a6faf6 100644 --- a/module/zfs/dnode_sync.c +++ b/module/zfs/dnode_sync.c @@ -422,11 +422,11 @@ dnode_sync_free_range_impl(dnode_t *dn, uint64_t blkid, uint64_t nblks, * match. */ 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; - ASSERTV(off = (dn->dn_phys->dn_maxblkid + 1) * - (dn->dn_phys->dn_datablkszsec << SPA_MINBLOCKSHIFT)); + off = (dn->dn_phys->dn_maxblkid + 1) * + (dn->dn_phys->dn_datablkszsec << SPA_MINBLOCKSHIFT); ASSERT(off < dn->dn_phys->dn_maxblkid || dn->dn_phys->dn_maxblkid == 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; int txgoff = tx->tx_txg & TXG_MASK; 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; ASSERT(dmu_tx_is_syncing(tx)); diff --git a/module/zfs/dsl_dataset.c b/module/zfs/dsl_dataset.c index aa37214d0c8e..38c3c9033af0 100644 --- a/module/zfs/dsl_dataset.c +++ b/module/zfs/dsl_dataset.c @@ -1366,7 +1366,7 @@ dsl_dataset_remove_from_next_clones(dsl_dataset_t *ds, uint64_t obj, dmu_tx_t *tx) { objset_t *mos = ds->ds_dir->dd_pool->dp_meta_objset; - ASSERTV(uint64_t count); + uint64_t count __maybe_unused; int err; 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; uint64_t dsobj, crtxg; objset_t *mos = dp->dp_meta_objset; - ASSERTV(static zil_header_t zero_zil); - ASSERTV(objset_t *os); + static zil_header_t zero_zil __maybe_unused; + objset_t *os __maybe_unused; ASSERT(RRW_WRITE_HELD(&dp->dp_config_rwlock)); @@ -2843,7 +2843,7 @@ dsl_dataset_stats(dsl_dataset_t *ds, nvlist_t *nv) void 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)); stat->dds_creation_txg = dsl_get_creationtxg(ds); @@ -2899,7 +2899,7 @@ dsl_dataset_space(dsl_dataset_t *ds, boolean_t 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; ASSERT(dsl_pool_config_held(dp)); diff --git a/module/zfs/dsl_destroy.c b/module/zfs/dsl_destroy.c index 37480c3f7ea6..01b5f080d974 100644 --- a/module/zfs/dsl_destroy.c +++ b/module/zfs/dsl_destroy.c @@ -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); if (dsl_dataset_phys(ds)->ds_next_clones_obj != 0) { - ASSERTV(uint64_t count); + uint64_t count __maybe_unused; ASSERT0(zap_count(mos, dsl_dataset_phys(ds)->ds_next_clones_obj, &count) && count == 0); diff --git a/module/zfs/dsl_dir.c b/module/zfs/dsl_dir.c index 373f661a6eb2..a4c64d63d955 100644 --- a/module/zfs/dsl_dir.c +++ b/module/zfs/dsl_dir.c @@ -141,7 +141,7 @@ dsl_dir_evict_async(void *dbu) { dsl_dir_t *dd = dbu; int t; - ASSERTV(dsl_pool_t *dp = dd->dd_pool); + dsl_pool_t *dp __maybe_unused = dd->dd_pool; dd->dd_dbuf = NULL; diff --git a/module/zfs/dsl_prop.c b/module/zfs/dsl_prop.c index df199cf6af5a..ad7b29a211d1 100644 --- a/module/zfs/dsl_prop.c +++ b/module/zfs/dsl_prop.c @@ -283,7 +283,7 @@ dsl_prop_register(dsl_dataset_t *ds, const char *propname, dsl_prop_record_t *pr; dsl_prop_cb_record_t *cbr; 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)); diff --git a/module/zfs/metaslab.c b/module/zfs/metaslab.c index 459f4dbbc1e2..2fc017b5b19c 100644 --- a/module/zfs/metaslab.c +++ b/module/zfs/metaslab.c @@ -3354,7 +3354,7 @@ metaslab_passivate_allocator(metaslab_group_t *mg, metaslab_t *msp, static void 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 @@ -5959,7 +5959,7 @@ static void metaslab_check_free_impl(vdev_t *vd, uint64_t offset, uint64_t size) { 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) return; diff --git a/module/zfs/sa.c b/module/zfs/sa.c index cc2a681bdfc7..557ab0949ca1 100644 --- a/module/zfs/sa.c +++ b/module/zfs/sa.c @@ -1237,7 +1237,7 @@ sa_byteswap(sa_handle_t *hdl, sa_buf_type_t buftype) dmu_buf_impl_t *db; int num_lengths = 1; 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)); if (sa_hdr_phys->sa_magic == SA_MAGIC) @@ -1344,7 +1344,7 @@ sa_idx_tab_rele(objset_t *os, void *arg) static void 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)); (void) zfs_refcount_add(&idx_tab->sa_refcount, NULL); diff --git a/module/zfs/spa.c b/module/zfs/spa.c index bd0090822d82..6cadefe91085 100644 --- a/module/zfs/spa.c +++ b/module/zfs/spa.c @@ -847,7 +847,7 @@ spa_prop_clear_bootfs(spa_t *spa, uint64_t dsobj, dmu_tx_t *tx) static int 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; vdev_t *rvd = spa->spa_root_vdev; uint64_t vdev_state; @@ -6530,7 +6530,7 @@ int spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *nvroot, int replacing) { 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_ops_t *pvops; 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; 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; boolean_t unspare = B_FALSE; uint64_t unspare_guid = 0; @@ -8640,8 +8640,8 @@ spa_sync_upgrades(spa_t *spa, dmu_tx_t *tx) static void vdev_indirect_state_sync_verify(vdev_t *vd) { - ASSERTV(vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping); - ASSERTV(vdev_indirect_births_t *vib = vd->vdev_indirect_births); + vdev_indirect_mapping_t *vim __maybe_unused = vd->vdev_indirect_mapping; + vdev_indirect_births_t *vib __maybe_unused = vd->vdev_indirect_births; if (vd->vdev_ops == &vdev_indirect_ops) { ASSERT(vim != NULL); diff --git a/module/zfs/txg.c b/module/zfs/txg.c index e972bcc2555b..8d1c2a5c8bab 100644 --- a/module/zfs/txg.c +++ b/module/zfs/txg.c @@ -813,7 +813,7 @@ txg_sync_waiting(dsl_pool_t *dp) void 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) return; ASSERT3U(txg, <=, dp->dp_tx.tx_open_txg); diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c index 30f0515cfaaf..7dc00650caa5 100644 --- a/module/zfs/vdev.c +++ b/module/zfs/vdev.c @@ -2197,7 +2197,7 @@ void vdev_close(vdev_t *vd) { 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); diff --git a/module/zfs/vdev_cache.c b/module/zfs/vdev_cache.c index 6cf449d4a00e..6e82184b800d 100644 --- a/module/zfs/vdev_cache.c +++ b/module/zfs/vdev_cache.c @@ -254,7 +254,7 @@ vdev_cache_read(zio_t *zio) vdev_cache_entry_t *ve, *ve_search; uint64_t cache_offset = P2ALIGN(zio->io_offset, VCBS); 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); diff --git a/module/zfs/vdev_indirect.c b/module/zfs/vdev_indirect.c index 4869402c282d..078ba8bab69b 100644 --- a/module/zfs/vdev_indirect.c +++ b/module/zfs/vdev_indirect.c @@ -421,7 +421,7 @@ vdev_indirect_should_condense(vdev_t *vd) * If nothing new has been marked obsolete, there is no * 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)); if (vd->vdev_obsolete_sm == NULL) { 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; 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)); ASSERT3P(sci, ==, spa->spa_condensing_indirect); @@ -815,7 +815,7 @@ void vdev_indirect_sync_obsolete(vdev_t *vd, dmu_tx_t *tx) { 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); ASSERT(range_tree_space(vd->vdev_obsolete_segments) > 0); @@ -1298,7 +1298,7 @@ vdev_indirect_read_all(zio_t *zio) static void 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); list_create(&iv->iv_splits, sizeof (indirect_split_t), offsetof(indirect_split_t, is_node)); diff --git a/module/zfs/vdev_indirect_mapping.c b/module/zfs/vdev_indirect_mapping.c index e4d998f09b85..bb484a401b1b 100644 --- a/module/zfs/vdev_indirect_mapping.c +++ b/module/zfs/vdev_indirect_mapping.c @@ -39,11 +39,12 @@ vdev_indirect_mapping_verify(vdev_indirect_mapping_t *vim) EQUIV(vim->vim_phys->vimp_num_entries > 0, vim->vim_entries != NULL); if (vim->vim_phys->vimp_num_entries > 0) { - ASSERTV(vdev_indirect_mapping_entry_phys_t *last_entry = - &vim->vim_entries[vim->vim_phys->vimp_num_entries - 1]); - ASSERTV(uint64_t offset = - DVA_MAPPING_GET_SRC_OFFSET(last_entry)); - ASSERTV(uint64_t size = DVA_GET_ASIZE(&last_entry->vimep_dst)); + vdev_indirect_mapping_entry_phys_t *last_entry __maybe_unused = + &vim->vim_entries[vim->vim_phys->vimp_num_entries - 1]; + uint64_t offset __maybe_unused = + DVA_MAPPING_GET_SRC_OFFSET(last_entry); + uint64_t size __maybe_unused = + DVA_GET_ASIZE(&last_entry->vimep_dst); ASSERT3U(vim->vim_phys->vimp_max_offset, >=, offset + size); } diff --git a/module/zfs/vdev_removal.c b/module/zfs/vdev_removal.c index 8089571e12e2..005e9baa8d21 100644 --- a/module/zfs/vdev_removal.c +++ b/module/zfs/vdev_removal.c @@ -248,7 +248,7 @@ vdev_remove_initiate_sync(void *arg, dmu_tx_t *tx) vdev_indirect_config_t *vic = &vd->vdev_indirect_config; objset_t *mos = spa->spa_dsl_pool->dp_meta_objset; 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); 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, VDEV_TOP_ZAP_OBSOLETE_COUNTS_ARE_PRECISE, sizeof (one), 1, &one, tx)); - ASSERTV(boolean_t are_precise); + boolean_t are_precise __maybe_unused; ASSERT0(vdev_obsolete_counts_are_precise(vd, &are_precise)); 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_t *spa = dmu_tx_pool(tx)->dp_spa; 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); vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping; diff --git a/module/zfs/zfeature.c b/module/zfs/zfeature.c index ed6ebcfc9de7..3757443a5a68 100644 --- a/module/zfs/zfeature.c +++ b/module/zfs/zfeature.c @@ -279,7 +279,7 @@ feature_get_refcount_from_disk(spa_t *spa, zfeature_info_t *feature, static int 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, 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; zfeature_info_t *feature = &spa_feature_table[fid]; - ASSERTV(uint64_t zapobj = + uint64_t zapobj __maybe_unused = (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(0 != zapobj); diff --git a/module/zfs/zio.c b/module/zfs/zio.c index 1ac2f52bbd50..4ec4bb69152d 100644 --- a/module/zfs/zio.c +++ b/module/zfs/zio.c @@ -2550,7 +2550,7 @@ zio_write_gang_member_ready(zio_t *zio) dva_t *cdva = zio->io_bp->blk_dva; dva_t *pdva = pio->io_bp->blk_dva; 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)) return; @@ -4184,7 +4184,7 @@ zio_ready(zio_t *zio) static void 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); vdev_t *vd = zio->io_vd; int flags = METASLAB_ASYNC_ALLOC; diff --git a/module/zfs/zio_inject.c b/module/zfs/zio_inject.c index d8af503bdfc2..fb8ce0916eb5 100644 --- a/module/zfs/zio_inject.c +++ b/module/zfs/zio_inject.c @@ -339,7 +339,7 @@ zio_handle_label_injection(zio_t *zio, int error) static int 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; uint_t byte = spa_get_random(len);