diff options
author | Madhav Suresh <[email protected]> | 2013-05-10 14:17:03 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2013-06-19 15:14:10 -0700 |
commit | c99c90015ece64746e20b74245caca41d1dbefe1 (patch) | |
tree | cc4e993d3796f076a2dd1de43b4a2bd38ba10cc8 /module/zfs | |
parent | 9eaf0832ad945fb8584c39fb9aeb5e8578912aeb (diff) |
Illumos #3006
3006 VERIFY[S,U,P] and ASSERT[S,U,P] frequently check if first
argument is zero
Reviewed by Matt Ahrens <[email protected]>
Reviewed by George Wilson <[email protected]>
Approved by Eric Schrock <[email protected]>
References:
illumos/illumos-gate@fb09f5aad449c97fe309678f3f604982b563a96f
https://illumos.org/issues/3006
Requires:
zfsonlinux/spl@1c6d149feb4033e4a56fb987004edc5d45288bcb
Ported-by: Tim Chase <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #1509
Diffstat (limited to 'module/zfs')
-rw-r--r-- | module/zfs/arc.c | 10 | ||||
-rw-r--r-- | module/zfs/bpobj.c | 2 | ||||
-rw-r--r-- | module/zfs/bptree.c | 14 | ||||
-rw-r--r-- | module/zfs/dbuf.c | 6 | ||||
-rw-r--r-- | module/zfs/dmu_send.c | 6 | ||||
-rw-r--r-- | module/zfs/dmu_traverse.c | 2 | ||||
-rw-r--r-- | module/zfs/dmu_tx.c | 2 | ||||
-rw-r--r-- | module/zfs/dnode.c | 76 | ||||
-rw-r--r-- | module/zfs/dnode_sync.c | 8 | ||||
-rw-r--r-- | module/zfs/dsl_dataset.c | 16 | ||||
-rw-r--r-- | module/zfs/dsl_dir.c | 12 | ||||
-rw-r--r-- | module/zfs/dsl_pool.c | 2 | ||||
-rw-r--r-- | module/zfs/dsl_synctask.c | 2 | ||||
-rw-r--r-- | module/zfs/metaslab.c | 2 | ||||
-rw-r--r-- | module/zfs/spa.c | 4 | ||||
-rw-r--r-- | module/zfs/space_map.c | 9 | ||||
-rw-r--r-- | module/zfs/vdev.c | 14 | ||||
-rw-r--r-- | module/zfs/vdev_raidz.c | 6 | ||||
-rw-r--r-- | module/zfs/zap.c | 10 | ||||
-rw-r--r-- | module/zfs/zap_micro.c | 2 | ||||
-rw-r--r-- | module/zfs/zfs_debug.c | 1 | ||||
-rw-r--r-- | module/zfs/zfs_ioctl.c | 2 | ||||
-rw-r--r-- | module/zfs/zfs_rlock.c | 9 | ||||
-rw-r--r-- | module/zfs/zfs_vfsops.c | 2 | ||||
-rw-r--r-- | module/zfs/zfs_vnops.c | 7 | ||||
-rw-r--r-- | module/zfs/zfs_znode.c | 9 | ||||
-rw-r--r-- | module/zfs/zil.c | 2 | ||||
-rw-r--r-- | module/zfs/zio.c | 2 |
28 files changed, 124 insertions, 115 deletions
diff --git a/module/zfs/arc.c b/module/zfs/arc.c index da070cd26..e70433c4f 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -1077,7 +1077,7 @@ add_reference(arc_buf_hdr_t *ab, kmutex_t *hash_lock, void *tag) ASSERT(list_link_active(&ab->b_arc_node)); list_remove(list, ab); if (GHOST_STATE(ab->b_state)) { - ASSERT3U(ab->b_datacnt, ==, 0); + ASSERT0(ab->b_datacnt); ASSERT3P(ab->b_buf, ==, NULL); delta = ab->b_size; } @@ -1772,7 +1772,7 @@ arc_evict(arc_state_t *state, uint64_t spa, int64_t bytes, boolean_t recycle, hash_lock = HDR_LOCK(ab); have_lock = MUTEX_HELD(hash_lock); if (have_lock || mutex_tryenter(hash_lock)) { - ASSERT3U(refcount_count(&ab->b_refcnt), ==, 0); + ASSERT0(refcount_count(&ab->b_refcnt)); ASSERT(ab->b_datacnt > 0); while (ab->b_buf) { arc_buf_t *buf = ab->b_buf; @@ -2718,7 +2718,7 @@ arc_access(arc_buf_hdr_t *buf, kmutex_t *hash_lock) * This is a prefetch access... * move this block back to the MRU state. */ - ASSERT3U(refcount_count(&buf->b_refcnt), ==, 0); + ASSERT0(refcount_count(&buf->b_refcnt)); new_state = arc_mru; } @@ -3061,7 +3061,7 @@ top: /* this block is in the ghost cache */ ASSERT(GHOST_STATE(hdr->b_state)); ASSERT(!HDR_IO_IN_PROGRESS(hdr)); - ASSERT3U(refcount_count(&hdr->b_refcnt), ==, 0); + ASSERT0(refcount_count(&hdr->b_refcnt)); ASSERT(hdr->b_buf == NULL); /* if this is a prefetch, we don't have a reference */ @@ -4723,7 +4723,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz) mutex_exit(&l2arc_buflist_mtx); if (pio == NULL) { - ASSERT3U(write_sz, ==, 0); + ASSERT0(write_sz); kmem_cache_free(hdr_cache, head); return (0); } diff --git a/module/zfs/bpobj.c b/module/zfs/bpobj.c index d5f8d4072..1920da440 100644 --- a/module/zfs/bpobj.c +++ b/module/zfs/bpobj.c @@ -43,7 +43,7 @@ bpobj_alloc_empty(objset_t *os, int blocksize, dmu_tx_t *tx) if (spa_feature_is_enabled(spa, empty_bpobj_feat)) { if (!spa_feature_is_active(spa, empty_bpobj_feat)) { - ASSERT3U(dp->dp_empty_bpobj, ==, 0); + ASSERT0(dp->dp_empty_bpobj); dp->dp_empty_bpobj = bpobj_alloc(os, SPA_MAXBLOCKSIZE, tx); VERIFY(zap_add(os, diff --git a/module/zfs/bptree.c b/module/zfs/bptree.c index 8c5a7d40e..db0a2d3c6 100644 --- a/module/zfs/bptree.c +++ b/module/zfs/bptree.c @@ -94,9 +94,9 @@ bptree_free(objset_t *os, uint64_t obj, dmu_tx_t *tx) VERIFY3U(0, ==, dmu_bonus_hold(os, obj, FTAG, &db)); bt = db->db_data; ASSERT3U(bt->bt_begin, ==, bt->bt_end); - ASSERT3U(bt->bt_bytes, ==, 0); - ASSERT3U(bt->bt_comp, ==, 0); - ASSERT3U(bt->bt_uncomp, ==, 0); + ASSERT0(bt->bt_bytes); + ASSERT0(bt->bt_comp); + ASSERT0(bt->bt_uncomp); dmu_buf_rele(db, FTAG); return (dmu_object_free(os, obj, tx)); @@ -197,7 +197,7 @@ bptree_iterate(objset_t *os, uint64_t obj, boolean_t free, bptree_itor_t func, /* save bookmark for future resume */ ASSERT3U(bte.be_zb.zb_objset, ==, ZB_DESTROYED_OBJSET); - ASSERT3U(bte.be_zb.zb_level, ==, 0); + ASSERT0(bte.be_zb.zb_level); dmu_write(os, obj, i * sizeof (bte), sizeof (bte), &bte, tx); break; @@ -213,9 +213,9 @@ bptree_iterate(objset_t *os, uint64_t obj, boolean_t free, bptree_itor_t func, /* if all blocks are free there should be no used space */ if (ba.ba_phys->bt_begin == ba.ba_phys->bt_end) { - ASSERT3U(ba.ba_phys->bt_bytes, ==, 0); - ASSERT3U(ba.ba_phys->bt_comp, ==, 0); - ASSERT3U(ba.ba_phys->bt_uncomp, ==, 0); + ASSERT0(ba.ba_phys->bt_bytes); + ASSERT0(ba.ba_phys->bt_comp); + ASSERT0(ba.ba_phys->bt_uncomp); } dmu_buf_rele(db, FTAG); diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c index 205abaada..83a8035dd 100644 --- a/module/zfs/dbuf.c +++ b/module/zfs/dbuf.c @@ -373,7 +373,7 @@ dbuf_verify(dmu_buf_impl_t *db) } else if (db->db_blkid == DMU_SPILL_BLKID) { ASSERT(dn != NULL); ASSERT3U(db->db.db_size, >=, dn->dn_bonuslen); - ASSERT3U(db->db.db_offset, ==, 0); + ASSERT0(db->db.db_offset); } else { ASSERT3U(db->db.db_offset, ==, db->db_blkid * db->db.db_size); } @@ -2433,7 +2433,7 @@ dbuf_sync_leaf(dbuf_dirty_record_t *dr, dmu_tx_t *tx) dbuf_dirty_record_t **drp; ASSERT(*datap != NULL); - ASSERT3U(db->db_level, ==, 0); + ASSERT0(db->db_level); ASSERT3U(dn->dn_phys->dn_bonuslen, <=, DN_MAX_BONUSLEN); bcopy(*datap, DN_BONUS(dn->dn_phys), dn->dn_phys->dn_bonuslen); DB_DNODE_EXIT(db); @@ -2636,7 +2636,7 @@ dbuf_write_done(zio_t *zio, arc_buf_t *buf, void *vdb) uint64_t txg = zio->io_txg; dbuf_dirty_record_t **drp, *dr; - ASSERT3U(zio->io_error, ==, 0); + ASSERT0(zio->io_error); ASSERT(db->db_blkptr == bp); if (zio->io_flags & ZIO_FLAG_IO_REWRITE) { diff --git a/module/zfs/dmu_send.c b/module/zfs/dmu_send.c index b2c6bfe2b..b25680360 100644 --- a/module/zfs/dmu_send.c +++ b/module/zfs/dmu_send.c @@ -67,7 +67,7 @@ dump_bytes_strategy(void *arg) dmu_sendarg_t *dsp = dbi->dbi_dsp; dsl_dataset_t *ds = dsp->dsa_os->os_dsl_dataset; ssize_t resid; /* have to get resid to get detailed errno */ - ASSERT3U(dbi->dbi_len % 8, ==, 0); + ASSERT0(dbi->dbi_len % 8); fletcher_4_incremental_native(dbi->dbi_buf, dbi->dbi_len, &dsp->dsa_zc); dsp->dsa_err = vn_rdwr(UIO_WRITE, dsp->dsa_vp, @@ -988,7 +988,7 @@ restore_read(struct restorearg *ra, int len) int done = 0; /* some things will require 8-byte alignment, so everything must */ - ASSERT3U(len % 8, ==, 0); + ASSERT0(len % 8); while (done < len) { ssize_t resid; @@ -1667,7 +1667,7 @@ out: (void) add_ds_to_guidmap(drc->drc_guid_to_ds_map, ds); dsl_dataset_disown(ds, dmu_recv_tag); myerr = dsl_dataset_destroy(drc->drc_real_ds, dmu_recv_tag, B_FALSE); - ASSERT3U(myerr, ==, 0); + ASSERT0(myerr); return (err); } diff --git a/module/zfs/dmu_traverse.c b/module/zfs/dmu_traverse.c index 980c1aa2f..84407f15f 100644 --- a/module/zfs/dmu_traverse.c +++ b/module/zfs/dmu_traverse.c @@ -174,7 +174,7 @@ static void traverse_pause(traverse_data_t *td, const zbookmark_t *zb) { ASSERT(td->td_resume != NULL); - ASSERT3U(zb->zb_level, ==, 0); + ASSERT0(zb->zb_level); bcopy(zb, td->td_resume, sizeof (*td->td_resume)); } diff --git a/module/zfs/dmu_tx.c b/module/zfs/dmu_tx.c index 81c86dff4..31c88c9d6 100644 --- a/module/zfs/dmu_tx.c +++ b/module/zfs/dmu_tx.c @@ -923,7 +923,7 @@ dmu_tx_try_assign(dmu_tx_t *tx, uint64_t txg_how) uint64_t memory, asize, fsize, usize; uint64_t towrite, tofree, tooverwrite, tounref, tohold, fudge; - ASSERT3U(tx->tx_txg, ==, 0); + ASSERT0(tx->tx_txg); if (tx->tx_err) { DMU_TX_STAT_BUMP(dmu_tx_error); diff --git a/module/zfs/dnode.c b/module/zfs/dnode.c index 3a8a5e32e..d8d66513d 100644 --- a/module/zfs/dnode.c +++ b/module/zfs/dnode.c @@ -139,32 +139,32 @@ dnode_dest(void *arg, void *unused) ASSERT(!list_link_active(&dn->dn_dirty_link[i])); avl_destroy(&dn->dn_ranges[i]); list_destroy(&dn->dn_dirty_records[i]); - ASSERT3U(dn->dn_next_nblkptr[i], ==, 0); - ASSERT3U(dn->dn_next_nlevels[i], ==, 0); - ASSERT3U(dn->dn_next_indblkshift[i], ==, 0); - ASSERT3U(dn->dn_next_bonustype[i], ==, 0); - ASSERT3U(dn->dn_rm_spillblk[i], ==, 0); - ASSERT3U(dn->dn_next_bonuslen[i], ==, 0); - ASSERT3U(dn->dn_next_blksz[i], ==, 0); + ASSERT0(dn->dn_next_nblkptr[i]); + ASSERT0(dn->dn_next_nlevels[i]); + ASSERT0(dn->dn_next_indblkshift[i]); + ASSERT0(dn->dn_next_bonustype[i]); + ASSERT0(dn->dn_rm_spillblk[i]); + ASSERT0(dn->dn_next_bonuslen[i]); + ASSERT0(dn->dn_next_blksz[i]); } - ASSERT3U(dn->dn_allocated_txg, ==, 0); - ASSERT3U(dn->dn_free_txg, ==, 0); - ASSERT3U(dn->dn_assigned_txg, ==, 0); - ASSERT3U(dn->dn_dirtyctx, ==, 0); + ASSERT0(dn->dn_allocated_txg); + ASSERT0(dn->dn_free_txg); + ASSERT0(dn->dn_assigned_txg); + ASSERT0(dn->dn_dirtyctx); ASSERT3P(dn->dn_dirtyctx_firstset, ==, NULL); ASSERT3P(dn->dn_bonus, ==, NULL); ASSERT(!dn->dn_have_spill); ASSERT3P(dn->dn_zio, ==, NULL); - ASSERT3U(dn->dn_oldused, ==, 0); - ASSERT3U(dn->dn_oldflags, ==, 0); - ASSERT3U(dn->dn_olduid, ==, 0); - ASSERT3U(dn->dn_oldgid, ==, 0); - ASSERT3U(dn->dn_newuid, ==, 0); - ASSERT3U(dn->dn_newgid, ==, 0); - ASSERT3U(dn->dn_id_flags, ==, 0); - - ASSERT3U(dn->dn_dbufs_count, ==, 0); + ASSERT0(dn->dn_oldused); + ASSERT0(dn->dn_oldflags); + ASSERT0(dn->dn_olduid); + ASSERT0(dn->dn_oldgid); + ASSERT0(dn->dn_newuid); + ASSERT0(dn->dn_newgid); + ASSERT0(dn->dn_id_flags); + + ASSERT0(dn->dn_dbufs_count); list_destroy(&dn->dn_dbufs); } @@ -361,7 +361,7 @@ dnode_rm_spill(dnode_t *dn, dmu_tx_t *tx) static void dnode_setdblksz(dnode_t *dn, int size) { - ASSERT3U(P2PHASE(size, SPA_MINBLOCKSIZE), ==, 0); + ASSERT0(P2PHASE(size, SPA_MINBLOCKSIZE)); ASSERT3U(size, <=, SPA_MAXBLOCKSIZE); ASSERT3U(size, >=, SPA_MINBLOCKSIZE); ASSERT3U(size >> SPA_MINBLOCKSHIFT, <, @@ -506,24 +506,24 @@ dnode_allocate(dnode_t *dn, dmu_object_type_t ot, int blocksize, int ibs, ASSERT(DMU_OT_IS_VALID(bonustype)); ASSERT3U(bonuslen, <=, DN_MAX_BONUSLEN); ASSERT(dn->dn_type == DMU_OT_NONE); - ASSERT3U(dn->dn_maxblkid, ==, 0); - ASSERT3U(dn->dn_allocated_txg, ==, 0); - ASSERT3U(dn->dn_assigned_txg, ==, 0); + ASSERT0(dn->dn_maxblkid); + ASSERT0(dn->dn_allocated_txg); + ASSERT0(dn->dn_assigned_txg); ASSERT(refcount_is_zero(&dn->dn_tx_holds)); ASSERT3U(refcount_count(&dn->dn_holds), <=, 1); ASSERT3P(list_head(&dn->dn_dbufs), ==, NULL); for (i = 0; i < TXG_SIZE; i++) { - ASSERT3U(dn->dn_next_nblkptr[i], ==, 0); - ASSERT3U(dn->dn_next_nlevels[i], ==, 0); - ASSERT3U(dn->dn_next_indblkshift[i], ==, 0); - ASSERT3U(dn->dn_next_bonuslen[i], ==, 0); - ASSERT3U(dn->dn_next_bonustype[i], ==, 0); - ASSERT3U(dn->dn_rm_spillblk[i], ==, 0); - ASSERT3U(dn->dn_next_blksz[i], ==, 0); + ASSERT0(dn->dn_next_nblkptr[i]); + ASSERT0(dn->dn_next_nlevels[i]); + ASSERT0(dn->dn_next_indblkshift[i]); + ASSERT0(dn->dn_next_bonuslen[i]); + ASSERT0(dn->dn_next_bonustype[i]); + ASSERT0(dn->dn_rm_spillblk[i]); + ASSERT0(dn->dn_next_blksz[i]); ASSERT(!list_link_active(&dn->dn_dirty_link[i])); ASSERT3P(list_head(&dn->dn_dirty_records[i]), ==, NULL); - ASSERT3U(avl_numnodes(&dn->dn_ranges[i]), ==, 0); + ASSERT0(avl_numnodes(&dn->dn_ranges[i])); } dn->dn_type = ot; @@ -565,7 +565,7 @@ dnode_reallocate(dnode_t *dn, dmu_object_type_t ot, int blocksize, ASSERT3U(blocksize, >=, SPA_MINBLOCKSIZE); ASSERT3U(blocksize, <=, SPA_MAXBLOCKSIZE); - ASSERT3U(blocksize % SPA_MINBLOCKSIZE, ==, 0); + ASSERT0(blocksize % SPA_MINBLOCKSIZE); ASSERT(dn->dn_object != DMU_META_DNODE_OBJECT || dmu_tx_private_ok(tx)); ASSERT(tx->tx_txg != 0); ASSERT((bonustype == DMU_OT_NONE && bonuslen == 0) || @@ -1236,9 +1236,9 @@ dnode_setdirty(dnode_t *dn, dmu_tx_t *tx) ASSERT(!refcount_is_zero(&dn->dn_holds) || list_head(&dn->dn_dbufs)); ASSERT(dn->dn_datablksz != 0); - ASSERT3U(dn->dn_next_bonuslen[txg&TXG_MASK], ==, 0); - ASSERT3U(dn->dn_next_blksz[txg&TXG_MASK], ==, 0); - ASSERT3U(dn->dn_next_bonustype[txg&TXG_MASK], ==, 0); + ASSERT0(dn->dn_next_bonuslen[txg&TXG_MASK]); + ASSERT0(dn->dn_next_blksz[txg&TXG_MASK]); + ASSERT0(dn->dn_next_bonustype[txg&TXG_MASK]); dprintf_ds(os->os_dsl_dataset, "obj=%llu txg=%llu\n", dn->dn_object, txg); @@ -1588,7 +1588,7 @@ dnode_free_range(dnode_t *dn, uint64_t off, uint64_t len, dmu_tx_t *tx) else tail = P2PHASE(len, blksz); - ASSERT3U(P2PHASE(off, blksz), ==, 0); + ASSERT0(P2PHASE(off, blksz)); /* zero out any partial block data at the end of the range */ if (tail) { if (len < tail) @@ -1770,7 +1770,7 @@ dnode_diduse_space(dnode_t *dn, int64_t delta) space += delta; if (spa_version(dn->dn_objset->os_spa) < SPA_VERSION_DNODE_BYTES) { ASSERT((dn->dn_phys->dn_flags & DNODE_FLAG_USED_BYTES) == 0); - ASSERT3U(P2PHASE(space, 1<<DEV_BSHIFT), ==, 0); + ASSERT0(P2PHASE(space, 1<<DEV_BSHIFT)); dn->dn_phys->dn_used = space >> DEV_BSHIFT; } else { dn->dn_phys->dn_used = space; diff --git a/module/zfs/dnode_sync.c b/module/zfs/dnode_sync.c index 58fa473cb..76e603753 100644 --- a/module/zfs/dnode_sync.c +++ b/module/zfs/dnode_sync.c @@ -274,7 +274,7 @@ free_children(dmu_buf_impl_t *db, uint64_t blkid, uint64_t nblks, int trunc, continue; rw_enter(&dn->dn_struct_rwlock, RW_READER); err = dbuf_hold_impl(dn, db->db_level-1, i, TRUE, FTAG, &subdb); - ASSERT3U(err, ==, 0); + ASSERT0(err); rw_exit(&dn->dn_struct_rwlock); if (free_children(subdb, blkid, nblks, trunc, tx) == ALL) { @@ -294,7 +294,7 @@ free_children(dmu_buf_impl_t *db, uint64_t blkid, uint64_t nblks, int trunc, continue; else if (i == end && !trunc) continue; - ASSERT3U(bp->blk_birth, ==, 0); + ASSERT0(bp->blk_birth); } #endif ASSERT(all || blocks_freed == 0 || db->db_last_dirty); @@ -350,7 +350,7 @@ dnode_sync_free_range(dnode_t *dn, uint64_t blkid, uint64_t nblks, dmu_tx_t *tx) continue; rw_enter(&dn->dn_struct_rwlock, RW_READER); err = dbuf_hold_impl(dn, dnlevel-1, i, TRUE, FTAG, &db); - ASSERT3U(err, ==, 0); + ASSERT0(err); rw_exit(&dn->dn_struct_rwlock); if (free_children(db, blkid, nblks, trunc, tx) == ALL) { @@ -475,7 +475,7 @@ dnode_sync_free(dnode_t *dn, dmu_tx_t *tx) * Our contents should have been freed in dnode_sync() by the * free range record inserted by the caller of dnode_free(). */ - ASSERT3U(DN_USED_BYTES(dn->dn_phys), ==, 0); + ASSERT0(DN_USED_BYTES(dn->dn_phys)); ASSERT(BP_IS_HOLE(dn->dn_phys->dn_blkptr)); dnode_undirty_dbufs(&dn->dn_dirty_records[txgoff]); diff --git a/module/zfs/dsl_dataset.c b/module/zfs/dsl_dataset.c index 55a8b0fc1..c1a029be7 100644 --- a/module/zfs/dsl_dataset.c +++ b/module/zfs/dsl_dataset.c @@ -1511,7 +1511,7 @@ remove_from_next_clones(dsl_dataset_t *ds, uint64_t obj, dmu_tx_t *tx) * remove this one. */ if (err != ENOENT) { - VERIFY3U(err, ==, 0); + VERIFY0(err); } ASSERT3U(0, ==, zap_count(mos, ds->ds_phys->ds_next_clones_obj, &count)); @@ -1598,7 +1598,7 @@ process_old_deadlist(dsl_dataset_t *ds, dsl_dataset_t *ds_prev, poa.pio = zio_root(dp->dp_spa, NULL, NULL, ZIO_FLAG_MUSTSUCCEED); VERIFY3U(0, ==, bpobj_iterate(&ds_next->ds_deadlist.dl_bpobj, process_old_cb, &poa, tx)); - VERIFY3U(zio_wait(poa.pio), ==, 0); + VERIFY0(zio_wait(poa.pio)); ASSERT3U(poa.used, ==, ds->ds_phys->ds_unique_bytes); /* change snapused */ @@ -1633,7 +1633,7 @@ old_synchronous_dataset_destroy(dsl_dataset_t *ds, dmu_tx_t *tx) err = traverse_dataset(ds, ds->ds_phys->ds_prev_snap_txg, TRAVERSE_POST, kill_blkptr, &ka); - ASSERT3U(err, ==, 0); + ASSERT0(err); ASSERT(!DS_UNIQUE_IS_ACCURATE(ds) || ds->ds_phys->ds_unique_bytes == 0); return (err); @@ -1685,7 +1685,7 @@ dsl_dataset_destroy_sync(void *arg1, void *tag, dmu_tx_t *tx) psa.psa_effective_value = 0; /* predict default value */ dsl_dataset_set_reservation_sync(ds, &psa, tx); - ASSERT3U(ds->ds_reserved, ==, 0); + ASSERT0(ds->ds_reserved); } ASSERT(RW_WRITE_HELD(&dp->dp_config_rwlock)); @@ -1952,7 +1952,7 @@ dsl_dataset_destroy_sync(void *arg1, void *tag, dmu_tx_t *tx) err = dsl_dataset_snap_lookup(ds_head, ds->ds_snapname, &val); - ASSERT3U(err, ==, 0); + ASSERT0(err); ASSERT3U(val, ==, obj); } #endif @@ -2458,13 +2458,13 @@ dsl_dataset_snapshot_rename_sync(void *arg1, void *arg2, dmu_tx_t *tx) VERIFY(0 == dsl_dataset_get_snapname(ds)); err = dsl_dataset_snap_remove(hds, ds->ds_snapname, tx); - ASSERT3U(err, ==, 0); + ASSERT0(err); mutex_enter(&ds->ds_lock); (void) strcpy(ds->ds_snapname, newsnapname); mutex_exit(&ds->ds_lock); err = zap_add(mos, hds->ds_phys->ds_snapnames_zapobj, ds->ds_snapname, 8, 1, &ds->ds_object, tx); - ASSERT3U(err, ==, 0); + ASSERT0(err); spa_history_log_internal(LOG_DS_RENAME, dd->dd_pool->dp_spa, tx, "dataset = %llu", ds->ds_object); @@ -2917,7 +2917,7 @@ dsl_dataset_promote_sync(void *arg1, void *arg2, dmu_tx_t *tx) zap_cursor_fini(&zc); } - ASSERT3U(dsl_prop_numcb(ds), ==, 0); + ASSERT0(dsl_prop_numcb(ds)); } /* diff --git a/module/zfs/dsl_dir.c b/module/zfs/dsl_dir.c index a25ebbfaa..69f68c209 100644 --- a/module/zfs/dsl_dir.c +++ b/module/zfs/dsl_dir.c @@ -500,10 +500,10 @@ dsl_dir_destroy_sync(void *arg1, void *tag, dmu_tx_t *tx) dsl_dir_set_reservation_sync(ds, &psa, tx); - ASSERT3U(dd->dd_phys->dd_used_bytes, ==, 0); - ASSERT3U(dd->dd_phys->dd_reserved, ==, 0); + ASSERT0(dd->dd_phys->dd_used_bytes); + ASSERT0(dd->dd_phys->dd_reserved); for (t = 0; t < DD_USED_NUM; t++) - ASSERT3U(dd->dd_phys->dd_used_breakdown[t], ==, 0); + ASSERT0(dd->dd_phys->dd_used_breakdown[t]); VERIFY(0 == zap_destroy(mos, dd->dd_phys->dd_child_dir_zapobj, tx)); VERIFY(0 == zap_destroy(mos, dd->dd_phys->dd_props_zapobj, tx)); @@ -592,7 +592,7 @@ dsl_dir_sync(dsl_dir_t *dd, dmu_tx_t *tx) ASSERT(dmu_tx_is_syncing(tx)); mutex_enter(&dd->dd_lock); - ASSERT3U(dd->dd_tempreserved[tx->tx_txg&TXG_MASK], ==, 0); + ASSERT0(dd->dd_tempreserved[tx->tx_txg&TXG_MASK]); dprintf_dd(dd, "txg=%llu towrite=%lluK\n", tx->tx_txg, dd->dd_space_towrite[tx->tx_txg&TXG_MASK] / 1024); dd->dd_space_towrite[tx->tx_txg&TXG_MASK] = 0; @@ -1323,7 +1323,7 @@ dsl_dir_rename_sync(void *arg1, void *arg2, dmu_tx_t *tx) /* remove from old parent zapobj */ err = zap_remove(mos, dd->dd_parent->dd_phys->dd_child_dir_zapobj, dd->dd_myname, tx); - ASSERT3U(err, ==, 0); + ASSERT0(err); (void) strcpy(dd->dd_myname, ra->mynewname); dsl_dir_close(dd->dd_parent, dd); @@ -1334,7 +1334,7 @@ dsl_dir_rename_sync(void *arg1, void *arg2, dmu_tx_t *tx) /* add to new parent zapobj */ err = zap_add(mos, ra->newparent->dd_phys->dd_child_dir_zapobj, dd->dd_myname, 8, 1, &dd->dd_object, tx); - ASSERT3U(err, ==, 0); + ASSERT0(err); spa_history_log_internal(LOG_DS_RENAME, dd->dd_pool->dp_spa, tx, "dataset = %llu", dd->dd_phys->dd_head_dataset_obj); diff --git a/module/zfs/dsl_pool.c b/module/zfs/dsl_pool.c index 771b265c2..6d25771a7 100644 --- a/module/zfs/dsl_pool.c +++ b/module/zfs/dsl_pool.c @@ -405,7 +405,7 @@ dsl_pool_create(spa_t *spa, nvlist_t *zplprops, uint64_t txg) /* create the pool directory */ err = zap_create_claim(dp->dp_meta_objset, DMU_POOL_DIRECTORY_OBJECT, DMU_OT_OBJECT_DIRECTORY, DMU_OT_NONE, 0, tx); - ASSERT3U(err, ==, 0); + ASSERT0(err); /* Initialize scan structures */ VERIFY3U(0, ==, dsl_scan_init(dp, txg)); diff --git a/module/zfs/dsl_synctask.c b/module/zfs/dsl_synctask.c index f807ccc69..75eb507b9 100644 --- a/module/zfs/dsl_synctask.c +++ b/module/zfs/dsl_synctask.c @@ -161,7 +161,7 @@ dsl_sync_task_group_sync(dsl_sync_task_group_t *dstg, dmu_tx_t *tx) dsl_pool_t *dp = dstg->dstg_pool; uint64_t quota, used; - ASSERT3U(dstg->dstg_err, ==, 0); + ASSERT0(dstg->dstg_err); /* * Check for sufficient space. We just check against what's diff --git a/module/zfs/metaslab.c b/module/zfs/metaslab.c index 76dc4f637..cc51ea4ba 100644 --- a/module/zfs/metaslab.c +++ b/module/zfs/metaslab.c @@ -792,7 +792,7 @@ metaslab_fini(metaslab_t *msp) for (t = 0; t < TXG_DEFER_SIZE; t++) space_map_destroy(&msp->ms_defermap[t]); - ASSERT3S(msp->ms_deferspace, ==, 0); + ASSERT0(msp->ms_deferspace); mutex_exit(&msp->ms_lock); mutex_destroy(&msp->ms_lock); diff --git a/module/zfs/spa.c b/module/zfs/spa.c index 82ee445ab..ba376fb58 100644 --- a/module/zfs/spa.c +++ b/module/zfs/spa.c @@ -5162,7 +5162,7 @@ spa_vdev_remove_evacuate(spa_t *spa, vdev_t *vd) * The evacuation succeeded. Remove any remaining MOS metadata * associated with this vdev, and wait for these changes to sync. */ - ASSERT3U(vd->vdev_stat.vs_alloc, ==, 0); + ASSERT0(vd->vdev_stat.vs_alloc); txg = spa_vdev_config_enter(spa); vd->vdev_removing = B_TRUE; vdev_dirty(vd, 0, NULL, txg); @@ -6163,7 +6163,7 @@ spa_sync(spa_t *spa, uint64_t txg) zio_t *zio = zio_root(spa, NULL, NULL, 0); VERIFY3U(bpobj_iterate(defer_bpo, spa_free_sync_cb, zio, tx), ==, 0); - VERIFY3U(zio_wait(zio), ==, 0); + VERIFY0(zio_wait(zio)); } /* diff --git a/module/zfs/space_map.c b/module/zfs/space_map.c index d99c7c0b3..ab7cb7a9a 100644 --- a/module/zfs/space_map.c +++ b/module/zfs/space_map.c @@ -22,6 +22,9 @@ * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ #include <sys/zfs_context.h> #include <sys/spa.h> @@ -90,7 +93,7 @@ void space_map_destroy(space_map_t *sm) { ASSERT(!sm->sm_loaded && !sm->sm_loading); - VERIFY3U(sm->sm_space, ==, 0); + VERIFY0(sm->sm_space); avl_destroy(&sm->sm_root); cv_destroy(&sm->sm_load_cv); } @@ -303,7 +306,7 @@ space_map_load(space_map_t *sm, space_map_ops_t *ops, uint8_t maptype, space = smo->smo_alloc; ASSERT(sm->sm_ops == NULL); - VERIFY3U(sm->sm_space, ==, 0); + VERIFY0(sm->sm_space); if (maptype == SM_FREE) { space_map_add(sm, sm->sm_start, sm->sm_size); @@ -501,7 +504,7 @@ space_map_sync(space_map_t *sm, uint8_t maptype, zio_buf_free(entry_map, bufsize); sm->sm_space -= delta; - VERIFY3U(sm->sm_space, ==, 0); + VERIFY0(sm->sm_space); } void diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c index c44e4f67f..7df0fd6a5 100644 --- a/module/zfs/vdev.c +++ b/module/zfs/vdev.c @@ -598,9 +598,9 @@ vdev_free(vdev_t *vd) metaslab_group_destroy(vd->vdev_mg); } - ASSERT3U(vd->vdev_stat.vs_space, ==, 0); - ASSERT3U(vd->vdev_stat.vs_dspace, ==, 0); - ASSERT3U(vd->vdev_stat.vs_alloc, ==, 0); + ASSERT0(vd->vdev_stat.vs_space); + ASSERT0(vd->vdev_stat.vs_dspace); + ASSERT0(vd->vdev_stat.vs_alloc); /* * Remove this vdev from its parent's child list. @@ -1825,7 +1825,7 @@ vdev_dtl_sync(vdev_t *vd, uint64_t txg) if (vd->vdev_detached) { if (smo->smo_object != 0) { - VERIFY(0 == dmu_object_free(mos, smo->smo_object, tx)); + VERIFY0(dmu_object_free(mos, smo->smo_object, tx)); smo->smo_object = 0; } dmu_tx_commit(tx); @@ -2029,7 +2029,7 @@ vdev_remove(vdev_t *vd, uint64_t txg) tx = dmu_tx_create_assigned(spa_get_dsl(spa), txg); if (vd->vdev_dtl_smo.smo_object) { - ASSERT3U(vd->vdev_dtl_smo.smo_alloc, ==, 0); + ASSERT0(vd->vdev_dtl_smo.smo_alloc); (void) dmu_object_free(mos, vd->vdev_dtl_smo.smo_object, tx); vd->vdev_dtl_smo.smo_object = 0; } @@ -2041,7 +2041,7 @@ vdev_remove(vdev_t *vd, uint64_t txg) if (msp == NULL || msp->ms_smo.smo_object == 0) continue; - ASSERT3U(msp->ms_smo.smo_alloc, ==, 0); + ASSERT0(msp->ms_smo.smo_alloc); (void) dmu_object_free(mos, msp->ms_smo.smo_object, tx); msp->ms_smo.smo_object = 0; } @@ -2319,7 +2319,7 @@ top: (void) spa_vdev_state_exit(spa, vd, 0); goto top; } - ASSERT3U(tvd->vdev_stat.vs_alloc, ==, 0); + ASSERT0(tvd->vdev_stat.vs_alloc); } /* diff --git a/module/zfs/vdev_raidz.c b/module/zfs/vdev_raidz.c index cb806c509..3e1878d37 100644 --- a/module/zfs/vdev_raidz.c +++ b/module/zfs/vdev_raidz.c @@ -281,7 +281,7 @@ vdev_raidz_map_free_vsd(zio_t *zio) { raidz_map_t *rm = zio->io_vsd; - ASSERT3U(rm->rm_freed, ==, 0); + ASSERT0(rm->rm_freed); rm->rm_freed = 1; if (rm->rm_reports == 0) @@ -1134,7 +1134,7 @@ vdev_raidz_matrix_invert(raidz_map_t *rm, int n, int nmissing, int *missing, */ for (i = 0; i < nmissing; i++) { for (j = 0; j < missing[i]; j++) { - ASSERT3U(rows[i][j], ==, 0); + ASSERT0(rows[i][j]); } ASSERT3U(rows[i][missing[i]], !=, 0); @@ -1175,7 +1175,7 @@ vdev_raidz_matrix_invert(raidz_map_t *rm, int n, int nmissing, int *missing, if (j == missing[i]) { ASSERT3U(rows[i][j], ==, 1); } else { - ASSERT3U(rows[i][j], ==, 0); + ASSERT0(rows[i][j]); } } } diff --git a/module/zfs/zap.c b/module/zfs/zap.c index a6c8c82ff..a7bae5e4e 100644 --- a/module/zfs/zap.c +++ b/module/zfs/zap.c @@ -162,7 +162,7 @@ zap_table_grow(zap_t *zap, zap_table_phys_t *tbl, } else { newblk = zap_allocate_blocks(zap, tbl->zt_numblks * 2); tbl->zt_nextblk = newblk; - ASSERT3U(tbl->zt_blks_copied, ==, 0); + ASSERT0(tbl->zt_blks_copied); dmu_prefetch(zap->zap_objset, zap->zap_object, tbl->zt_blk << bs, tbl->zt_numblks << bs); } @@ -339,7 +339,7 @@ zap_grow_ptrtbl(zap_t *zap, dmu_tx_t *tx) ASSERT3U(zap->zap_f.zap_phys->zap_ptrtbl.zt_shift, ==, ZAP_EMBEDDED_PTRTBL_SHIFT(zap)); - ASSERT3U(zap->zap_f.zap_phys->zap_ptrtbl.zt_blk, ==, 0); + ASSERT0(zap->zap_f.zap_phys->zap_ptrtbl.zt_blk); newblk = zap_allocate_blocks(zap, 1); err = dmu_buf_hold(zap->zap_objset, zap->zap_object, @@ -475,7 +475,7 @@ zap_open_leaf(uint64_t blkid, dmu_buf_t *db) * chain. There should be no chained leafs (as we have removed * support for them). */ - ASSERT3U(l->l_phys->l_hdr.lh_pad1, ==, 0); + ASSERT0(l->l_phys->l_hdr.lh_pad1); /* * There should be more hash entries than there can be @@ -658,9 +658,9 @@ zap_expand_leaf(zap_name_t *zn, zap_leaf_t *l, dmu_tx_t *tx, zap_leaf_t **lp) zap_leaf_split(l, nl, zap->zap_normflags != 0); /* set sibling pointers */ - for (i = 0; i < (1ULL<<prefix_diff); i++) { + for (i = 0; i < (1ULL << prefix_diff); i++) { err = zap_set_idx_to_blk(zap, sibling+i, nl->l_blkid, tx); - ASSERT3U(err, ==, 0); /* we checked for i/o errors above */ + ASSERT0(err); /* we checked for i/o errors above */ } if (hash & (1ULL << (64 - l->l_phys->l_hdr.lh_prefix_len))) { diff --git a/module/zfs/zap_micro.c b/module/zfs/zap_micro.c index 3d8cae0d3..4da783647 100644 --- a/module/zfs/zap_micro.c +++ b/module/zfs/zap_micro.c @@ -506,7 +506,7 @@ zap_lockdir(objset_t *os, uint64_t obj, dmu_tx_t *tx, return (mzap_upgrade(zapp, tx, 0)); } err = dmu_object_set_blocksize(os, obj, newsz, 0, tx); - ASSERT3U(err, ==, 0); + ASSERT0(err); zap->zap_m.zap_num_chunks = db->db_size / MZAP_ENT_LEN - 1; } diff --git a/module/zfs/zfs_debug.c b/module/zfs/zfs_debug.c index e56177815..ad611ac91 100644 --- a/module/zfs/zfs_debug.c +++ b/module/zfs/zfs_debug.c @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #include <sys/zfs_context.h> diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c index 5560b2548..e1b8543d3 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -1779,7 +1779,7 @@ zfs_ioc_objset_stats_impl(zfs_cmd_t *zc, objset_t *os) error = zvol_get_stats(os, nv); if (error == EIO) return (error); - VERIFY3S(error, ==, 0); + VERIFY0(error); } if (error == 0) error = put_nvlist(zc, nv); diff --git a/module/zfs/zfs_rlock.c b/module/zfs/zfs_rlock.c index 325d5aae5..136972b32 100644 --- a/module/zfs/zfs_rlock.c +++ b/module/zfs/zfs_rlock.c @@ -22,6 +22,9 @@ * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ /* * This file contains the code to implement file range locking in @@ -495,9 +498,9 @@ zfs_range_unlock_reader(znode_t *zp, rl_t *remove, list_t *free_list) list_insert_tail(free_list, remove); } else { - ASSERT3U(remove->r_cnt, ==, 0); - ASSERT3U(remove->r_write_wanted, ==, 0); - ASSERT3U(remove->r_read_wanted, ==, 0); + ASSERT0(remove->r_cnt); + ASSERT0(remove->r_write_wanted); + ASSERT0(remove->r_read_wanted); /* * Find start proxy representing this reader lock, * then decrement ref count on all proxies diff --git a/module/zfs/zfs_vfsops.c b/module/zfs/zfs_vfsops.c index 620e39bc2..e618f2bbf 100644 --- a/module/zfs/zfs_vfsops.c +++ b/module/zfs/zfs_vfsops.c @@ -1537,7 +1537,7 @@ zfs_set_version(zfs_sb_t *zsb, uint64_t newvers) error = zap_add(os, MASTER_NODE_OBJ, ZFS_SA_ATTRS, 8, 1, &sa_obj, tx); - ASSERT3U(error, ==, 0); + ASSERT0(error); VERIFY(0 == sa_set_sa_object(os, sa_obj)); sa_register_update_callback(os, zfs_sa_upgrade); diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c index 8ec4db26f..3b671b4ac 100644 --- a/module/zfs/zfs_vnops.c +++ b/module/zfs/zfs_vnops.c @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ /* Portions Copyright 2007 Jeremy Teo */ @@ -1523,7 +1524,7 @@ top: &xattr_obj, sizeof (xattr_obj)); if (error == 0 && xattr_obj) { error = zfs_zget(zsb, xattr_obj, &xzp); - ASSERT3U(error, ==, 0); + ASSERT0(error); dmu_tx_hold_sa(tx, zp->z_sa_hdl, B_TRUE); dmu_tx_hold_sa(tx, xzp->z_sa_hdl, B_FALSE); } @@ -2837,7 +2838,7 @@ top: zp->z_mode = new_mode; ASSERT3P(aclp, !=, NULL); err = zfs_aclset_common(zp, aclp, cr, tx); - ASSERT3U(err, ==, 0); + ASSERT0(err); if (zp->z_acl_cached) zfs_acl_free(zp->z_acl_cached); zp->z_acl_cached = aclp; @@ -3346,7 +3347,7 @@ top: error = sa_update(szp->z_sa_hdl, SA_ZPL_FLAGS(zsb), (void *)&szp->z_pflags, sizeof (uint64_t), tx); - ASSERT3U(error, ==, 0); + ASSERT0(error); error = zfs_link_destroy(sdl, szp, tx, ZRENAMING, NULL); if (error == 0) { diff --git a/module/zfs/zfs_znode.c b/module/zfs/zfs_znode.c index 9bf26a734..5922d3afa 100644 --- a/module/zfs/zfs_znode.c +++ b/module/zfs/zfs_znode.c @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ /* Portions Copyright 2007 Jeremy Teo */ @@ -555,7 +556,7 @@ zfs_mknode(znode_t *dzp, vattr_t *vap, dmu_tx_t *tx, cred_t *cr, err = zap_create_claim_norm(zsb->z_os, obj, zsb->z_norm, DMU_OT_DIRECTORY_CONTENTS, obj_type, bonuslen, tx); - ASSERT3U(err, ==, 0); + ASSERT0(err); } else { obj = zap_create_norm(zsb->z_os, zsb->z_norm, DMU_OT_DIRECTORY_CONTENTS, @@ -566,7 +567,7 @@ zfs_mknode(znode_t *dzp, vattr_t *vap, dmu_tx_t *tx, cred_t *cr, err = dmu_object_claim(zsb->z_os, obj, DMU_OT_PLAIN_FILE_CONTENTS, 0, obj_type, bonuslen, tx); - ASSERT3U(err, ==, 0); + ASSERT0(err); } else { obj = dmu_object_alloc(zsb->z_os, DMU_OT_PLAIN_FILE_CONTENTS, 0, @@ -746,7 +747,7 @@ zfs_mknode(znode_t *dzp, vattr_t *vap, dmu_tx_t *tx, cred_t *cr, if (obj_type == DMU_OT_ZNODE || acl_ids->z_aclp->z_version < ZFS_ACL_VERSION_FUID) { err = zfs_aclset_common(*zpp, acl_ids->z_aclp, cr, tx); - ASSERT3S(err, ==, 0); + ASSERT0(err); } kmem_free(sa_attrs, sizeof(sa_bulk_attr_t) * ZPL_END); ZFS_OBJ_HOLD_EXIT(zsb, obj); @@ -1170,7 +1171,7 @@ zfs_grow_blocksize(znode_t *zp, uint64_t size, dmu_tx_t *tx) if (error == ENOTSUP) return; - ASSERT3U(error, ==, 0); + ASSERT0(error); /* What blocksize did we actually get? */ dmu_object_size_from_db(sa_get_db(zp->z_sa_hdl), &zp->z_blksz, &dummy); diff --git a/module/zfs/zil.c b/module/zfs/zil.c index 99d932fc0..64de856f0 100644 --- a/module/zfs/zil.c +++ b/module/zfs/zil.c @@ -1163,7 +1163,7 @@ zil_lwb_commit(zilog_t *zilog, itx_t *itx, lwb_t *lwb) lwb->lwb_nused += reclen + dlen; lwb->lwb_max_txg = MAX(lwb->lwb_max_txg, txg); ASSERT3U(lwb->lwb_nused, <=, lwb->lwb_sz); - ASSERT3U(P2PHASE(lwb->lwb_nused, sizeof (uint64_t)), ==, 0); + ASSERT0(P2PHASE(lwb->lwb_nused, sizeof (uint64_t))); return (lwb); } diff --git a/module/zfs/zio.c b/module/zfs/zio.c index 099349186..e93b7739f 100644 --- a/module/zfs/zio.c +++ b/module/zfs/zio.c @@ -2303,7 +2303,7 @@ zio_dva_allocate(zio_t *zio) } ASSERT(BP_IS_HOLE(bp)); - ASSERT3U(BP_GET_NDVAS(bp), ==, 0); + ASSERT0(BP_GET_NDVAS(bp)); ASSERT3U(zio->io_prop.zp_copies, >, 0); ASSERT3U(zio->io_prop.zp_copies, <=, spa_max_replication(spa)); ASSERT3U(zio->io_size, ==, BP_GET_PSIZE(bp)); |