Resolve upstream unused variables so we can remove the -Wno-unused

compile option.  In most case the variables are only unused when
debugging is disabled (ASSERT) however they do waste stack if that
case if the compiler doesn't optimize it out (it should).  But more
importantly disabling this warning prevent us from noticing legit
unused variables accidentally left in other place of the code.
This commit is contained in:
Brian Behlendorf 2009-03-11 22:07:25 -07:00
parent 32d4d74b04
commit ecd2dbcb44
9 changed files with 20 additions and 27 deletions

View File

@ -1852,9 +1852,8 @@ arc_shrink(void)
static int
arc_reclaim_needed(void)
{
uint64_t extra;
#ifdef _KERNEL
uint64_t extra;
if (needfree)
return (1);
@ -2513,7 +2512,7 @@ arc_read(zio_t *pio, spa_t *spa, blkptr_t *bp, arc_buf_t *pbuf,
err = arc_read_nolock(pio, spa, bp, done, private, priority,
zio_flags, arc_flags, zb);
ASSERT3P(hdr, ==, pbuf->b_hdr);
VERIFY3P(hdr, ==, pbuf->b_hdr);
rw_exit(&pbuf->b_lock);
return (err);
}

View File

@ -316,12 +316,12 @@ dbuf_verify(dmu_buf_impl_t *db)
* dnode_set_blksz().
*/
if (db->db_level == 0 && db->db.db_object == DMU_META_DNODE_OBJECT) {
dbuf_dirty_record_t *dr = db->db_data_pending;
/*
* It should only be modified in syncing context, so
* make sure we only have one copy of the data.
*/
ASSERT(dr == NULL || dr->dt.dl.dr_data == db->db_buf);
ASSERT(db->db_data_pending == NULL ||
db->db_data_pending->dt.dl.dr_data == db->db_buf);
}
/* verify db->db_blkptr */
@ -337,7 +337,6 @@ 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;
ASSERT3U(db->db_parent->db_level, ==, db->db_level+1);
ASSERT3U(db->db_parent->db.db_object, ==,
db->db.db_object);
@ -349,7 +348,9 @@ dbuf_verify(dmu_buf_impl_t *db)
if (RW_WRITE_HELD(&db->db_dnode->dn_struct_rwlock)) {
ASSERT3P(db->db_blkptr, ==,
((blkptr_t *)db->db_parent->db.db_data +
db->db_blkid % epb));
db->db_blkid %
(db->db_parent->db.db_size >>
SPA_BLKPTRSHIFT)));
}
}
}
@ -362,11 +363,10 @@ 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;
int i;
for (i = 0; i < db->db.db_size >> 3; i++) {
ASSERT(buf[i] == 0);
ASSERT(db->db.db_data[i] == 0);
}
}
}

View File

@ -823,10 +823,8 @@ dmu_sync_ready(zio_t *zio, arc_buf_t *buf, void *varg)
blkptr_t *bp = zio->io_bp;
if (!BP_IS_HOLE(bp)) {
dmu_sync_arg_t *in = varg;
dbuf_dirty_record_t *dr = in->dr;
dmu_buf_impl_t *db = dr->dr_dbuf;
ASSERT(BP_GET_TYPE(bp) == db->db_dnode->dn_type);
ASSERT(BP_GET_TYPE(bp) == ((dmu_sync_arg_t *)
varg)->dr->dr_dbuf->db_dnode->dn_type);
ASSERT(BP_GET_LEVEL(bp) == 0);
bp->blk_fill = 1;
}

View File

@ -860,7 +860,7 @@ ready(zio_t *zio, arc_buf_t *abuf, void *arg)
bp->blk_fill += dnp->dn_blkptr[i].blk_fill;
if (zio->io_flags & ZIO_FLAG_IO_REWRITE) {
ASSERT(DVA_EQUAL(BP_IDENTITY(bp), BP_IDENTITY(bp_orig)));
VERIFY(DVA_EQUAL(BP_IDENTITY(bp), BP_IDENTITY(bp_orig)));
} else {
if (zio->io_bp_orig.blk_birth == os->os_synctx->tx_txg)
(void) dsl_dataset_block_kill(os->os_dsl_dataset,

View File

@ -1699,7 +1699,7 @@ dsl_dataset_destroy_sync(void *arg1, void *tag, cred_t *cr, dmu_tx_t *tx)
if (ds->ds_phys->ds_next_clones_obj != 0) {
uint64_t count;
ASSERT(0 == zap_count(mos,
VERIFY(0 == zap_count(mos,
ds->ds_phys->ds_next_clones_obj, &count) && count == 0);
VERIFY(0 == dmu_object_free(mos,
ds->ds_phys->ds_next_clones_obj, tx));

View File

@ -2889,7 +2889,6 @@ int
spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *nvroot, int replacing)
{
uint64_t txg, open_txg;
vdev_t *rvd = spa->spa_root_vdev;
vdev_t *oldvd, *newvd, *newrootvd, *pvd, *tvd;
vdev_ops_t *pvops;
dmu_tx_t *tx;
@ -3007,7 +3006,7 @@ spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *nvroot, int replacing)
if (pvd->vdev_ops != pvops)
pvd = vdev_add_parent(oldvd, pvops);
ASSERT(pvd->vdev_top->vdev_parent == rvd);
ASSERT(pvd->vdev_top->vdev_parent == spa->spa_root_vdev);
ASSERT(pvd->vdev_ops == pvops);
ASSERT(oldvd->vdev_parent == pvd);
@ -3026,7 +3025,7 @@ spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *nvroot, int replacing)
tvd = newvd->vdev_top;
ASSERT(pvd->vdev_top == tvd);
ASSERT(tvd->vdev_parent == rvd);
ASSERT(tvd->vdev_parent == spa->spa_root_vdev);
vdev_config_dirty(tvd);
@ -3085,7 +3084,6 @@ 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;
vdev_t *vd, *pvd, *cvd, *tvd;
boolean_t unspare = B_FALSE;
uint64_t unspare_guid;
@ -3229,7 +3227,7 @@ spa_vdev_detach(spa_t *spa, uint64_t guid, uint64_t pguid, int replace_done)
* may have been the previous top-level vdev.
*/
tvd = cvd->vdev_top;
ASSERT(tvd->vdev_parent == rvd);
ASSERT(tvd->vdev_parent == spa->spa_root_vdev);
/*
* Reevaluate the parent vdev state.

View File

@ -1217,9 +1217,8 @@ vdev_validate(vdev_t *vd)
void
vdev_close(vdev_t *vd)
{
spa_t *spa = vd->vdev_spa;
ASSERT(spa_config_held(spa, SCL_STATE_ALL, RW_WRITER) == SCL_STATE_ALL);
ASSERT(spa_config_held(vd->vdev_spa, SCL_STATE_ALL, RW_WRITER) ==
SCL_STATE_ALL);
vd->vdev_ops->vdev_op_close(vd);

View File

@ -749,8 +749,8 @@ 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];
ASSERT(strcmp(zn->zn_name_orij, mze->mze_name) != 0);
ASSERT(strcmp(zn->zn_name_orij,
(&zap->zap_m.zap_phys->mz_chunk[i])->mze_name) != 0);
}
#endif

View File

@ -1522,7 +1522,6 @@ static void
zio_write_gang_member_ready(zio_t *zio)
{
zio_t *pio = zio_unique_parent(zio);
zio_t *lio = zio->io_logical;
dva_t *cdva = zio->io_bp->blk_dva;
dva_t *pdva = pio->io_bp->blk_dva;
uint64_t asize;
@ -1533,7 +1532,7 @@ zio_write_gang_member_ready(zio_t *zio)
ASSERT(BP_IS_HOLE(&zio->io_bp_orig));
ASSERT(zio->io_child_type == ZIO_CHILD_GANG);
ASSERT3U(zio->io_prop.zp_ndvas, ==, lio->io_prop.zp_ndvas);
ASSERT3U(zio->io_prop.zp_ndvas, ==, zio->io_logical->io_prop.zp_ndvas);
ASSERT3U(zio->io_prop.zp_ndvas, <=, BP_GET_NDVAS(zio->io_bp));
ASSERT3U(pio->io_prop.zp_ndvas, <=, BP_GET_NDVAS(pio->io_bp));
ASSERT3U(BP_GET_NDVAS(zio->io_bp), <=, BP_GET_NDVAS(pio->io_bp));