aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmd/zpool/zpool_main.c2
-rw-r--r--cmd/ztest/ztest.c4
-rw-r--r--module/zfs/arc.c3
-rw-r--r--module/zfs/dbuf.c12
-rw-r--r--module/zfs/dnode.c2
-rw-r--r--module/zfs/dnode_sync.c10
-rw-r--r--module/zfs/dsl_dataset.c10
-rw-r--r--module/zfs/dsl_dir.c2
-rw-r--r--module/zfs/sa.c8
-rw-r--r--module/zfs/spa.c4
-rw-r--r--module/zfs/vdev.c8
-rw-r--r--module/zfs/vdev_cache.c2
-rw-r--r--module/zfs/zap_micro.c5
-rw-r--r--module/zfs/zio.c4
14 files changed, 38 insertions, 38 deletions
diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c
index 4fe14c827..85a51de40 100644
--- a/cmd/zpool/zpool_main.c
+++ b/cmd/zpool/zpool_main.c
@@ -2202,7 +2202,7 @@ get_interval_count(int *argcp, char **argv, unsigned long *iv,
unsigned long *cnt)
{
unsigned long interval = 0, count = 0;
- int argc = *argcp, errno;
+ int argc = *argcp;
/*
* Determine if the last argument is an integer or a pool name
diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c
index 5677dcb85..ad7373558 100644
--- a/cmd/ztest/ztest.c
+++ b/cmd/ztest/ztest.c
@@ -1042,6 +1042,7 @@ ztest_pattern_set(void *buf, uint64_t size, uint64_t value)
*ip++ = value;
}
+#ifndef NDEBUG
static boolean_t
ztest_pattern_match(void *buf, uint64_t size, uint64_t value)
{
@@ -1054,6 +1055,7 @@ ztest_pattern_match(void *buf, uint64_t size, uint64_t value)
return (diff == 0);
}
+#endif
static void
ztest_bt_generate(ztest_block_tag_t *bt, objset_t *os, uint64_t object,
@@ -2582,7 +2584,7 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, uint64_t id)
vdev_t *
grow_vdev(vdev_t *vd, void *arg)
{
- spa_t *spa = vd->vdev_spa;
+ ASSERTV(spa_t *spa = vd->vdev_spa);
size_t *newsize = arg;
size_t fsize;
int fd;
diff --git a/module/zfs/arc.c b/module/zfs/arc.c
index c1b867174..96c3fb702 100644
--- a/module/zfs/arc.c
+++ b/module/zfs/arc.c
@@ -1989,9 +1989,8 @@ arc_shrink(void)
static int
arc_reclaim_needed(void)
{
- uint64_t extra;
-
#ifdef _KERNEL
+ uint64_t extra;
if (needfree)
return (1);
diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c
index 8fcc1b23d..7b66fcea4 100644
--- a/module/zfs/dbuf.c
+++ b/module/zfs/dbuf.c
@@ -373,7 +373,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 */
- int epb = db->db_parent->db.db_size >> SPA_BLKPTRSHIFT;
+ ASSERTV(int epb = 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);
@@ -399,7 +400,7 @@ dbuf_verify(dmu_buf_impl_t *db)
* data when we evict this buffer.
*/
if (db->db_dirtycnt == 0) {
- uint64_t *buf = db->db.db_data;
+ ASSERTV(uint64_t *buf = db->db.db_data);
int i;
for (i = 0; i < db->db.db_size >> 3; i++) {
@@ -1999,8 +2000,7 @@ dbuf_rm_spill(dnode_t *dn, dmu_tx_t *tx)
void
dbuf_add_ref(dmu_buf_impl_t *db, void *tag)
{
- int64_t holds = refcount_add(&db->db_holds, tag);
- ASSERT(holds > 1);
+ VERIFY(refcount_add(&db->db_holds, tag) > 1);
}
/*
@@ -2564,8 +2564,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)) {
- int epbs =
- dn->dn_phys->dn_indblkshift - SPA_BLKPTRSHIFT;
+ ASSERTV(int epbs = dn->dn_phys->dn_indblkshift -
+ SPA_BLKPTRSHIFT);
ASSERT3U(BP_GET_LSIZE(db->db_blkptr), ==,
db->db.db_size);
ASSERT3U(dn->dn_phys->dn_maxblkid
diff --git a/module/zfs/dnode.c b/module/zfs/dnode.c
index f26aef22c..a7ae39e9d 100644
--- a/module/zfs/dnode.c
+++ b/module/zfs/dnode.c
@@ -52,7 +52,7 @@ static kmem_cache_t *dnode_cache;
#define DNODE_STAT_ADD(stat) /* nothing */
#endif /* DNODE_STATS */
-static dnode_phys_t dnode_phys_zero;
+ASSERTV(static dnode_phys_t dnode_phys_zero);
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 0b5535db6..7d304b2f7 100644
--- a/module/zfs/dnode_sync.c
+++ b/module/zfs/dnode_sync.c
@@ -328,8 +328,8 @@ dnode_sync_free_range(dnode_t *dn, uint64_t blkid, uint64_t nblks, dmu_tx_t *tx)
ASSERT3U(blkid + nblks, <=, dn->dn_phys->dn_nblkptr);
(void) free_blocks(dn, bp + blkid, nblks, tx);
if (trunc) {
- uint64_t off = (dn->dn_phys->dn_maxblkid + 1) *
- (dn->dn_phys->dn_datablkszsec << SPA_MINBLOCKSHIFT);
+ ASSERTV(uint64_t off = (dn->dn_phys->dn_maxblkid + 1) *
+ (dn->dn_phys->dn_datablkszsec<<SPA_MINBLOCKSHIFT));
dn->dn_phys->dn_maxblkid = (blkid ? blkid - 1 : 0);
ASSERT(off < dn->dn_phys->dn_maxblkid ||
dn->dn_phys->dn_maxblkid == 0 ||
@@ -358,8 +358,8 @@ dnode_sync_free_range(dnode_t *dn, uint64_t blkid, uint64_t nblks, dmu_tx_t *tx)
dbuf_rele(db, FTAG);
}
if (trunc) {
- uint64_t off = (dn->dn_phys->dn_maxblkid + 1) *
- (dn->dn_phys->dn_datablkszsec << SPA_MINBLOCKSHIFT);
+ ASSERTV(uint64_t off = (dn->dn_phys->dn_maxblkid + 1) *
+ (dn->dn_phys->dn_datablkszsec << SPA_MINBLOCKSHIFT));
dn->dn_phys->dn_maxblkid = (blkid ? blkid - 1 : 0);
ASSERT(off < dn->dn_phys->dn_maxblkid ||
dn->dn_phys->dn_maxblkid == 0 ||
@@ -527,8 +527,8 @@ 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];
- static const dnode_phys_t zerodn = { 0 };
boolean_t kill_spill = B_FALSE;
+ ASSERTV(static const dnode_phys_t zerodn = { 0 });
ASSERT(dmu_tx_is_syncing(tx));
ASSERT(dnp->dn_type != DMU_OT_NONE || dn->dn_allocated_txg);
diff --git a/module/zfs/dsl_dataset.c b/module/zfs/dsl_dataset.c
index 8c6f3fbea..34fd758c4 100644
--- a/module/zfs/dsl_dataset.c
+++ b/module/zfs/dsl_dataset.c
@@ -1121,8 +1121,7 @@ dsl_dataset_destroy(dsl_dataset_t *ds, void *tag, boolean_t defer)
*/
if (ds->ds_phys->ds_bp.blk_fill == 0 &&
dmu_objset_userused_enabled(os)) {
- uint64_t count;
-
+ ASSERTV(uint64_t count);
ASSERT(zap_count(os, DMU_USERUSED_OBJECT, &count) != 0 ||
count == 0);
ASSERT(zap_count(os, DMU_GROUPUSED_OBJECT, &count) != 0 ||
@@ -1495,8 +1494,8 @@ static void
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;
- uint64_t count;
int err;
+ ASSERTV(uint64_t count);
ASSERT(ds->ds_phys->ds_num_children >= 2);
err = zap_remove_int(mos, ds->ds_phys->ds_next_clones_obj, obj, tx);
@@ -1921,7 +1920,7 @@ dsl_dataset_destroy_sync(void *arg1, void *tag, dmu_tx_t *tx)
"dataset = %llu", ds->ds_object);
if (ds->ds_phys->ds_next_clones_obj != 0) {
- uint64_t count;
+ ASSERTV(uint64_t count);
ASSERT(0 == zap_count(mos,
ds->ds_phys->ds_next_clones_obj, &count) && count == 0);
VERIFY(0 == dmu_object_free(mos,
@@ -2251,7 +2250,7 @@ dsl_dataset_space(dsl_dataset_t *ds,
boolean_t
dsl_dataset_modified_since_lastsnap(dsl_dataset_t *ds)
{
- dsl_pool_t *dp = ds->ds_dir->dd_pool;
+ ASSERTV(dsl_pool_t *dp = ds->ds_dir->dd_pool);
ASSERT(RW_LOCK_HELD(&dp->dp_config_rwlock) ||
dsl_pool_sync_context(dp));
@@ -2522,7 +2521,6 @@ struct promotearg {
};
static int snaplist_space(list_t *l, uint64_t mintxg, uint64_t *spacep);
-static boolean_t snaplist_unstable(list_t *l);
static int
dsl_dataset_promote_check(void *arg1, void *arg2, dmu_tx_t *tx)
diff --git a/module/zfs/dsl_dir.c b/module/zfs/dsl_dir.c
index 2e52f9c73..ec1a6bb70 100644
--- a/module/zfs/dsl_dir.c
+++ b/module/zfs/dsl_dir.c
@@ -47,7 +47,7 @@ static void
dsl_dir_evict(dmu_buf_t *db, void *arg)
{
dsl_dir_t *dd = arg;
- dsl_pool_t *dp = dd->dd_pool;
+ ASSERTV(dsl_pool_t *dp = dd->dd_pool;)
int t;
for (t = 0; t < TXG_SIZE; t++) {
diff --git a/module/zfs/sa.c b/module/zfs/sa.c
index f94b6ac38..4e71c407f 100644
--- a/module/zfs/sa.c
+++ b/module/zfs/sa.c
@@ -1206,9 +1206,9 @@ sa_byteswap(sa_handle_t *hdl, sa_buf_type_t buftype)
{
sa_hdr_phys_t *sa_hdr_phys = SA_GET_HDR(hdl, buftype);
dmu_buf_impl_t *db;
- sa_os_t *sa = hdl->sa_os->os_sa;
int num_lengths = 1;
int i;
+ ASSERTV(sa_os_t *sa = hdl->sa_os->os_sa);
ASSERT(MUTEX_HELD(&sa->sa_lock));
if (sa_hdr_phys->sa_magic == SA_MAGIC)
@@ -1309,7 +1309,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)
{
- sa_os_t *sa = os->os_sa;
+ ASSERTV(sa_os_t *sa = os->os_sa);
ASSERT(MUTEX_HELD(&sa->sa_lock));
(void) refcount_add(&idx_tab->sa_refcount, NULL);
@@ -1345,10 +1345,10 @@ sa_handle_get_from_db(objset_t *os, dmu_buf_t *db, void *userp,
sa_handle_type_t hdl_type, sa_handle_t **handlepp)
{
int error = 0;
- dmu_object_info_t doi;
sa_handle_t *handle;
-
#ifdef ZFS_DEBUG
+ dmu_object_info_t doi;
+
dmu_object_info_from_db(db, &doi);
ASSERT(doi.doi_bonus_type == DMU_OT_SA ||
doi.doi_bonus_type == DMU_OT_ZNODE);
diff --git a/module/zfs/spa.c b/module/zfs/spa.c
index b397a19b3..0711102b4 100644
--- a/module/zfs/spa.c
+++ b/module/zfs/spa.c
@@ -3816,7 +3816,7 @@ int
spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *nvroot, int replacing)
{
uint64_t txg, dtl_max_txg;
- vdev_t *rvd = spa->spa_root_vdev;
+ ASSERTV(vdev_t *rvd = spa->spa_root_vdev;)
vdev_t *oldvd, *newvd, *newrootvd, *pvd, *tvd;
vdev_ops_t *pvops;
char *oldvdpath, *newvdpath;
@@ -4016,7 +4016,7 @@ spa_vdev_detach(spa_t *spa, uint64_t guid, uint64_t pguid, int replace_done)
{
uint64_t txg;
int error;
- vdev_t *rvd = spa->spa_root_vdev;
+ ASSERTV(vdev_t *rvd = spa->spa_root_vdev;)
vdev_t *vd, *pvd, *cvd, *tvd;
boolean_t unspare = B_FALSE;
uint64_t unspare_guid;
diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c
index 234933d2c..7a16a9865 100644
--- a/module/zfs/vdev.c
+++ b/module/zfs/vdev.c
@@ -1412,8 +1412,8 @@ vdev_validate(vdev_t *vd)
void
vdev_close(vdev_t *vd)
{
- spa_t *spa = vd->vdev_spa;
vdev_t *pvd = vd->vdev_parent;
+ ASSERTV(spa_t *spa = vd->vdev_spa);
ASSERT(spa_config_held(spa, SCL_STATE_ALL, RW_WRITER) == SCL_STATE_ALL);
@@ -1795,8 +1795,7 @@ vdev_dtl_sync(vdev_t *vd, uint64_t txg)
if (vd->vdev_detached) {
if (smo->smo_object != 0) {
- int err = dmu_object_free(mos, smo->smo_object, tx);
- ASSERT3U(err, ==, 0);
+ VERIFY(0 == dmu_object_free(mos, smo->smo_object, tx));
smo->smo_object = 0;
}
dmu_tx_commit(tx);
@@ -3084,7 +3083,8 @@ vdev_load_log_state(vdev_t *nvd, vdev_t *ovd)
int c;
ASSERT(nvd->vdev_top->vdev_islog);
- ASSERT(spa_config_held(spa, SCL_STATE_ALL, RW_WRITER) == SCL_STATE_ALL);
+ ASSERT(spa_config_held(nvd->vdev_spa,
+ SCL_STATE_ALL, RW_WRITER) == SCL_STATE_ALL);
ASSERT3U(nvd->vdev_guid, ==, ovd->vdev_guid);
for (c = 0; c < nvd->vdev_children; c++)
diff --git a/module/zfs/vdev_cache.c b/module/zfs/vdev_cache.c
index 688d54134..a4b34423a 100644
--- a/module/zfs/vdev_cache.c
+++ b/module/zfs/vdev_cache.c
@@ -246,7 +246,7 @@ vdev_cache_read(zio_t *zio)
vdev_cache_t *vc = &zio->io_vd->vdev_cache;
vdev_cache_entry_t *ve, ve_search;
uint64_t cache_offset = P2ALIGN(zio->io_offset, VCBS);
- uint64_t cache_phase = P2PHASE(zio->io_offset, VCBS);
+ ASSERTV(uint64_t cache_phase = P2PHASE(zio->io_offset, VCBS);)
zio_t *fio;
ASSERT(zio->io_type == ZIO_TYPE_READ);
diff --git a/module/zfs/zap_micro.c b/module/zfs/zap_micro.c
index cc061eec8..7627504a9 100644
--- a/module/zfs/zap_micro.c
+++ b/module/zfs/zap_micro.c
@@ -937,7 +937,7 @@ mzap_addent(zap_name_t *zn, uint64_t value)
#ifdef ZFS_DEBUG
for (i = 0; i < zap->zap_m.zap_num_chunks; i++) {
- mzap_ent_phys_t *mze = &zap->zap_m.zap_phys->mz_chunk[i];
+ ASSERTV(mzap_ent_phys_t *mze=&zap->zap_m.zap_phys->mz_chunk[i]);
ASSERT(strcmp(zn->zn_key_orig, mze->mze_name) != 0);
}
#endif
@@ -1043,12 +1043,13 @@ zap_update(objset_t *os, uint64_t zapobj, const char *name,
{
zap_t *zap;
mzap_ent_t *mze;
- uint64_t oldval;
const uint64_t *intval = val;
zap_name_t *zn;
int err;
#ifdef ZFS_DEBUG
+ uint64_t oldval;
+
/*
* If there is an old value, it shouldn't change across the
* lockdir (eg, due to bprewrite's xlation).
diff --git a/module/zfs/zio.c b/module/zfs/zio.c
index 0bf0f6e12..2d8c7e9bd 100644
--- a/module/zfs/zio.c
+++ b/module/zfs/zio.c
@@ -1634,7 +1634,7 @@ static void
zio_write_gang_member_ready(zio_t *zio)
{
zio_t *pio = zio_unique_parent(zio);
- zio_t *gio = zio->io_gang_leader;
+ ASSERTV(zio_t *gio = zio->io_gang_leader;)
dva_t *cdva = zio->io_bp->blk_dva;
dva_t *pdva = pio->io_bp->blk_dva;
uint64_t asize;
@@ -1949,12 +1949,12 @@ static void
zio_ddt_ditto_write_done(zio_t *zio)
{
int p = DDT_PHYS_DITTO;
- zio_prop_t *zp = &zio->io_prop;
blkptr_t *bp = zio->io_bp;
ddt_t *ddt = ddt_select(zio->io_spa, bp);
ddt_entry_t *dde = zio->io_private;
ddt_phys_t *ddp = &dde->dde_phys[p];
ddt_key_t *ddk = &dde->dde_key;
+ ASSERTV(zio_prop_t *zp = &zio->io_prop);
ddt_enter(ddt);