--- /dev/null
+From: Brian Behlendorf <behlendorf1@llnl.gov>
+Subject: [PATCH] gcc-unused
+
+Gcc -Wall warn: 'unused variable'
+
+Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
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);
}
#pragma weak dmu_buf_rele = dbuf_rele
ASSERT(arc_released(db->db_buf));
}
} else {
- dnode_t *dn = db->db_dnode;
-
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<<db->db_dnode->dn_phys->dn_indblkshift);
if (!BP_IS_HOLE(db->db_blkptr)) {
- 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
- >> (db->db_level * epbs), >=, db->db_blkid);
+ ASSERT3U(db->db_dnode->dn_phys->dn_maxblkid >> (db->db_level *
+ (db->db_dnode->dn_phys->dn_indblkshift - SPA_BLKPTRSHIFT)),
+ >=, db->db_blkid);
arc_set_callback(db->db_buf, dbuf_do_evict, db);
}
mutex_destroy(&dr->dt.di.dr_mtx);
static kmem_cache_t *dnode_cache;
+#ifndef NDEBUG
static dnode_phys_t dnode_phys_zero;
+#endif
int zfs_default_bs = SPA_MINBLOCKSHIFT;
int zfs_default_ibs = DN_MAX_INDBLKSHIFT;
for (i = 0; i < epb; i++) {
dnode_t *dn = children_dnodes[i];
- int n;
if (dn == NULL)
continue;
#ifdef ZFS_DEBUG
+ {
+ int n;
/*
* If there are holds on this dnode, then there should
* be holds on the dnode's containing dbuf as well; thus
for (n = 0; n < TXG_SIZE; n++)
ASSERT(!list_link_active(&dn->dn_dirty_link[n]));
+ }
#endif
children_dnodes[i] = NULL;
dnode_destroy(dn);
ASSERT3U(blkid + nblks, <=, dn->dn_phys->dn_nblkptr);
(void) free_blocks(dn, bp + blkid, nblks, tx);
if (trunc) {
+#ifndef NDEBUG
uint64_t off = (dn->dn_phys->dn_maxblkid + 1) *
(dn->dn_phys->dn_datablkszsec << SPA_MINBLOCKSHIFT);
+#endif
dn->dn_phys->dn_maxblkid = (blkid ? blkid - 1 : 0);
ASSERT(off < dn->dn_phys->dn_maxblkid ||
dn->dn_phys->dn_maxblkid == 0 ||
dbuf_rele(db, FTAG);
}
if (trunc) {
+#ifndef NDEBUG
uint64_t off = (dn->dn_phys->dn_maxblkid + 1) *
(dn->dn_phys->dn_datablkszsec << SPA_MINBLOCKSHIFT);
+#endif
dn->dn_phys->dn_maxblkid = (blkid ? blkid - 1 : 0);
ASSERT(off < dn->dn_phys->dn_maxblkid ||
dn->dn_phys->dn_maxblkid == 0 ||
boolean_t
dsl_dataset_modified_since_lastsnap(dsl_dataset_t *ds)
{
- dsl_pool_t *dp = ds->ds_dir->dd_pool;
-
- ASSERT(RW_LOCK_HELD(&dp->dp_config_rwlock) ||
- dsl_pool_sync_context(dp));
+ ASSERT(RW_LOCK_HELD(&(ds->ds_dir->dd_pool)->dp_config_rwlock) ||
+ dsl_pool_sync_context(ds->ds_dir->dd_pool));
if (ds->ds_prev == NULL)
return (B_FALSE);
if (ds->ds_phys->ds_bp.blk_birth >
dsl_dir_evict(dmu_buf_t *db, void *arg)
{
dsl_dir_t *dd = arg;
- dsl_pool_t *dp = dd->dd_pool;
int t;
for (t = 0; t < TXG_SIZE; t++) {
- ASSERT(!txg_list_member(&dp->dp_dirty_dirs, dd, t));
+ ASSERT(!txg_list_member(&dd->dd_pool->dp_dirty_dirs, dd, t));
ASSERT(dd->dd_tempreserved[t] == 0);
ASSERT(dd->dd_space_towrite[t] == 0);
}
if (psa->numints == 0) {
int err = zap_remove(mos, zapobj, psa->name, tx);
- ASSERT(err == 0 || err == ENOENT);
+ VERIFY(0 == err || ENOENT == err);
if (isint) {
VERIFY(0 == dsl_prop_get_ds(ds,
psa->name, 8, 1, &intval, NULL));
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);
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);
zio_t *fio;
ASSERT(zio->io_type == ZIO_TYPE_READ);
if (P2BOUNDARY(zio->io_offset, zio->io_size, VCBS))
return (EXDEV);
- ASSERT(cache_phase + zio->io_size <= VCBS);
+ ASSERT(P2PHASE(zio->io_offset, VCBS) + zio->io_size <= VCBS);
mutex_enter(&vc->vc_lock);