Fix gcc unused variable warnings

Gcc -Wall warn: 'unused variable'

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
Brian Behlendorf 2010-08-26 09:53:00 -07:00
parent c65aa5b2b9
commit 1fde1e3720
14 changed files with 38 additions and 38 deletions

View File

@ -2202,7 +2202,7 @@ get_interval_count(int *argcp, char **argv, unsigned long *iv,
unsigned long *cnt) unsigned long *cnt)
{ {
unsigned long interval = 0, count = 0; 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 * Determine if the last argument is an integer or a pool name

View File

@ -1042,6 +1042,7 @@ ztest_pattern_set(void *buf, uint64_t size, uint64_t value)
*ip++ = value; *ip++ = value;
} }
#ifndef NDEBUG
static boolean_t static boolean_t
ztest_pattern_match(void *buf, uint64_t size, uint64_t value) 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); return (diff == 0);
} }
#endif
static void static void
ztest_bt_generate(ztest_block_tag_t *bt, objset_t *os, uint64_t object, 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 * vdev_t *
grow_vdev(vdev_t *vd, void *arg) 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 *newsize = arg;
size_t fsize; size_t fsize;
int fd; int fd;

View File

@ -1989,9 +1989,8 @@ arc_shrink(void)
static int static int
arc_reclaim_needed(void) arc_reclaim_needed(void)
{ {
uint64_t extra;
#ifdef _KERNEL #ifdef _KERNEL
uint64_t extra;
if (needfree) if (needfree)
return (1); return (1);

View File

@ -373,7 +373,8 @@ dbuf_verify(dmu_buf_impl_t *db)
&dn->dn_phys->dn_blkptr[db->db_blkid]); &dn->dn_phys->dn_blkptr[db->db_blkid]);
} else { } else {
/* db is pointed to by an indirect block */ /* 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_level, ==, db->db_level+1);
ASSERT3U(db->db_parent->db.db_object, ==, ASSERT3U(db->db_parent->db.db_object, ==,
db->db.db_object); db->db.db_object);
@ -399,7 +400,7 @@ dbuf_verify(dmu_buf_impl_t *db)
* data when we evict this buffer. * data when we evict this buffer.
*/ */
if (db->db_dirtycnt == 0) { if (db->db_dirtycnt == 0) {
uint64_t *buf = db->db.db_data; ASSERTV(uint64_t *buf = db->db.db_data);
int i; int i;
for (i = 0; i < db->db.db_size >> 3; 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 void
dbuf_add_ref(dmu_buf_impl_t *db, void *tag) dbuf_add_ref(dmu_buf_impl_t *db, void *tag)
{ {
int64_t holds = refcount_add(&db->db_holds, tag); VERIFY(refcount_add(&db->db_holds, tag) > 1);
ASSERT(holds > 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); 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<<dn->dn_phys->dn_indblkshift);
if (!BP_IS_HOLE(db->db_blkptr)) { if (!BP_IS_HOLE(db->db_blkptr)) {
int epbs = ASSERTV(int epbs = dn->dn_phys->dn_indblkshift -
dn->dn_phys->dn_indblkshift - SPA_BLKPTRSHIFT; SPA_BLKPTRSHIFT);
ASSERT3U(BP_GET_LSIZE(db->db_blkptr), ==, ASSERT3U(BP_GET_LSIZE(db->db_blkptr), ==,
db->db.db_size); db->db.db_size);
ASSERT3U(dn->dn_phys->dn_maxblkid ASSERT3U(dn->dn_phys->dn_maxblkid

View File

@ -52,7 +52,7 @@ static kmem_cache_t *dnode_cache;
#define DNODE_STAT_ADD(stat) /* nothing */ #define DNODE_STAT_ADD(stat) /* nothing */
#endif /* DNODE_STATS */ #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_bs = SPA_MINBLOCKSHIFT;
int zfs_default_ibs = DN_MAX_INDBLKSHIFT; int zfs_default_ibs = DN_MAX_INDBLKSHIFT;

View File

@ -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); ASSERT3U(blkid + nblks, <=, dn->dn_phys->dn_nblkptr);
(void) free_blocks(dn, bp + blkid, nblks, tx); (void) free_blocks(dn, bp + blkid, nblks, tx);
if (trunc) { if (trunc) {
uint64_t off = (dn->dn_phys->dn_maxblkid + 1) * ASSERTV(uint64_t off = (dn->dn_phys->dn_maxblkid + 1) *
(dn->dn_phys->dn_datablkszsec << SPA_MINBLOCKSHIFT); (dn->dn_phys->dn_datablkszsec<<SPA_MINBLOCKSHIFT));
dn->dn_phys->dn_maxblkid = (blkid ? blkid - 1 : 0); dn->dn_phys->dn_maxblkid = (blkid ? blkid - 1 : 0);
ASSERT(off < dn->dn_phys->dn_maxblkid || ASSERT(off < dn->dn_phys->dn_maxblkid ||
dn->dn_phys->dn_maxblkid == 0 || 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); dbuf_rele(db, FTAG);
} }
if (trunc) { if (trunc) {
uint64_t off = (dn->dn_phys->dn_maxblkid + 1) * ASSERTV(uint64_t off = (dn->dn_phys->dn_maxblkid + 1) *
(dn->dn_phys->dn_datablkszsec << SPA_MINBLOCKSHIFT); (dn->dn_phys->dn_datablkszsec << SPA_MINBLOCKSHIFT));
dn->dn_phys->dn_maxblkid = (blkid ? blkid - 1 : 0); dn->dn_phys->dn_maxblkid = (blkid ? blkid - 1 : 0);
ASSERT(off < dn->dn_phys->dn_maxblkid || ASSERT(off < dn->dn_phys->dn_maxblkid ||
dn->dn_phys->dn_maxblkid == 0 || 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; dnode_phys_t *dnp = dn->dn_phys;
int txgoff = tx->tx_txg & TXG_MASK; int txgoff = tx->tx_txg & TXG_MASK;
list_t *list = &dn->dn_dirty_records[txgoff]; list_t *list = &dn->dn_dirty_records[txgoff];
static const dnode_phys_t zerodn = { 0 };
boolean_t kill_spill = B_FALSE; boolean_t kill_spill = B_FALSE;
ASSERTV(static const dnode_phys_t zerodn = { 0 });
ASSERT(dmu_tx_is_syncing(tx)); ASSERT(dmu_tx_is_syncing(tx));
ASSERT(dnp->dn_type != DMU_OT_NONE || dn->dn_allocated_txg); ASSERT(dnp->dn_type != DMU_OT_NONE || dn->dn_allocated_txg);

View File

@ -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 && if (ds->ds_phys->ds_bp.blk_fill == 0 &&
dmu_objset_userused_enabled(os)) { dmu_objset_userused_enabled(os)) {
uint64_t count; ASSERTV(uint64_t count);
ASSERT(zap_count(os, DMU_USERUSED_OBJECT, &count) != 0 || ASSERT(zap_count(os, DMU_USERUSED_OBJECT, &count) != 0 ||
count == 0); count == 0);
ASSERT(zap_count(os, DMU_GROUPUSED_OBJECT, &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) 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; objset_t *mos = ds->ds_dir->dd_pool->dp_meta_objset;
uint64_t count;
int err; int err;
ASSERTV(uint64_t count);
ASSERT(ds->ds_phys->ds_num_children >= 2); ASSERT(ds->ds_phys->ds_num_children >= 2);
err = zap_remove_int(mos, ds->ds_phys->ds_next_clones_obj, obj, tx); 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); "dataset = %llu", ds->ds_object);
if (ds->ds_phys->ds_next_clones_obj != 0) { if (ds->ds_phys->ds_next_clones_obj != 0) {
uint64_t count; ASSERTV(uint64_t count);
ASSERT(0 == zap_count(mos, ASSERT(0 == zap_count(mos,
ds->ds_phys->ds_next_clones_obj, &count) && count == 0); ds->ds_phys->ds_next_clones_obj, &count) && count == 0);
VERIFY(0 == dmu_object_free(mos, VERIFY(0 == dmu_object_free(mos,
@ -2251,7 +2250,7 @@ dsl_dataset_space(dsl_dataset_t *ds,
boolean_t boolean_t
dsl_dataset_modified_since_lastsnap(dsl_dataset_t *ds) 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) || ASSERT(RW_LOCK_HELD(&dp->dp_config_rwlock) ||
dsl_pool_sync_context(dp)); 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 int snaplist_space(list_t *l, uint64_t mintxg, uint64_t *spacep);
static boolean_t snaplist_unstable(list_t *l);
static int static int
dsl_dataset_promote_check(void *arg1, void *arg2, dmu_tx_t *tx) dsl_dataset_promote_check(void *arg1, void *arg2, dmu_tx_t *tx)

View File

@ -47,7 +47,7 @@ static void
dsl_dir_evict(dmu_buf_t *db, void *arg) dsl_dir_evict(dmu_buf_t *db, void *arg)
{ {
dsl_dir_t *dd = arg; dsl_dir_t *dd = arg;
dsl_pool_t *dp = dd->dd_pool; ASSERTV(dsl_pool_t *dp = dd->dd_pool;)
int t; int t;
for (t = 0; t < TXG_SIZE; t++) { for (t = 0; t < TXG_SIZE; t++) {

View File

@ -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); sa_hdr_phys_t *sa_hdr_phys = SA_GET_HDR(hdl, buftype);
dmu_buf_impl_t *db; dmu_buf_impl_t *db;
sa_os_t *sa = hdl->sa_os->os_sa;
int num_lengths = 1; int num_lengths = 1;
int i; int i;
ASSERTV(sa_os_t *sa = hdl->sa_os->os_sa);
ASSERT(MUTEX_HELD(&sa->sa_lock)); ASSERT(MUTEX_HELD(&sa->sa_lock));
if (sa_hdr_phys->sa_magic == SA_MAGIC) if (sa_hdr_phys->sa_magic == SA_MAGIC)
@ -1309,7 +1309,7 @@ sa_idx_tab_rele(objset_t *os, void *arg)
static void static void
sa_idx_tab_hold(objset_t *os, sa_idx_tab_t *idx_tab) 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)); ASSERT(MUTEX_HELD(&sa->sa_lock));
(void) refcount_add(&idx_tab->sa_refcount, NULL); (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) sa_handle_type_t hdl_type, sa_handle_t **handlepp)
{ {
int error = 0; int error = 0;
dmu_object_info_t doi;
sa_handle_t *handle; sa_handle_t *handle;
#ifdef ZFS_DEBUG #ifdef ZFS_DEBUG
dmu_object_info_t doi;
dmu_object_info_from_db(db, &doi); dmu_object_info_from_db(db, &doi);
ASSERT(doi.doi_bonus_type == DMU_OT_SA || ASSERT(doi.doi_bonus_type == DMU_OT_SA ||
doi.doi_bonus_type == DMU_OT_ZNODE); doi.doi_bonus_type == DMU_OT_ZNODE);

View File

@ -3816,7 +3816,7 @@ int
spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *nvroot, int replacing) spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *nvroot, int replacing)
{ {
uint64_t txg, dtl_max_txg; 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_t *oldvd, *newvd, *newrootvd, *pvd, *tvd;
vdev_ops_t *pvops; vdev_ops_t *pvops;
char *oldvdpath, *newvdpath; 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; uint64_t txg;
int error; int error;
vdev_t *rvd = spa->spa_root_vdev; ASSERTV(vdev_t *rvd = spa->spa_root_vdev;)
vdev_t *vd, *pvd, *cvd, *tvd; vdev_t *vd, *pvd, *cvd, *tvd;
boolean_t unspare = B_FALSE; boolean_t unspare = B_FALSE;
uint64_t unspare_guid; uint64_t unspare_guid;

View File

@ -1412,8 +1412,8 @@ vdev_validate(vdev_t *vd)
void void
vdev_close(vdev_t *vd) vdev_close(vdev_t *vd)
{ {
spa_t *spa = vd->vdev_spa;
vdev_t *pvd = vd->vdev_parent; 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); 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 (vd->vdev_detached) {
if (smo->smo_object != 0) { if (smo->smo_object != 0) {
int err = dmu_object_free(mos, smo->smo_object, tx); VERIFY(0 == dmu_object_free(mos, smo->smo_object, tx));
ASSERT3U(err, ==, 0);
smo->smo_object = 0; smo->smo_object = 0;
} }
dmu_tx_commit(tx); dmu_tx_commit(tx);
@ -3084,7 +3083,8 @@ vdev_load_log_state(vdev_t *nvd, vdev_t *ovd)
int c; int c;
ASSERT(nvd->vdev_top->vdev_islog); 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); ASSERT3U(nvd->vdev_guid, ==, ovd->vdev_guid);
for (c = 0; c < nvd->vdev_children; c++) for (c = 0; c < nvd->vdev_children; c++)

View File

@ -246,7 +246,7 @@ vdev_cache_read(zio_t *zio)
vdev_cache_t *vc = &zio->io_vd->vdev_cache; vdev_cache_t *vc = &zio->io_vd->vdev_cache;
vdev_cache_entry_t *ve, ve_search; vdev_cache_entry_t *ve, ve_search;
uint64_t cache_offset = P2ALIGN(zio->io_offset, VCBS); 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; zio_t *fio;
ASSERT(zio->io_type == ZIO_TYPE_READ); ASSERT(zio->io_type == ZIO_TYPE_READ);

View File

@ -937,7 +937,7 @@ mzap_addent(zap_name_t *zn, uint64_t value)
#ifdef ZFS_DEBUG #ifdef ZFS_DEBUG
for (i = 0; i < zap->zap_m.zap_num_chunks; i++) { 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); ASSERT(strcmp(zn->zn_key_orig, mze->mze_name) != 0);
} }
#endif #endif
@ -1043,12 +1043,13 @@ zap_update(objset_t *os, uint64_t zapobj, const char *name,
{ {
zap_t *zap; zap_t *zap;
mzap_ent_t *mze; mzap_ent_t *mze;
uint64_t oldval;
const uint64_t *intval = val; const uint64_t *intval = val;
zap_name_t *zn; zap_name_t *zn;
int err; int err;
#ifdef ZFS_DEBUG #ifdef ZFS_DEBUG
uint64_t oldval;
/* /*
* If there is an old value, it shouldn't change across the * If there is an old value, it shouldn't change across the
* lockdir (eg, due to bprewrite's xlation). * lockdir (eg, due to bprewrite's xlation).

View File

@ -1634,7 +1634,7 @@ static void
zio_write_gang_member_ready(zio_t *zio) zio_write_gang_member_ready(zio_t *zio)
{ {
zio_t *pio = zio_unique_parent(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 *cdva = zio->io_bp->blk_dva;
dva_t *pdva = pio->io_bp->blk_dva; dva_t *pdva = pio->io_bp->blk_dva;
uint64_t asize; uint64_t asize;
@ -1949,12 +1949,12 @@ static void
zio_ddt_ditto_write_done(zio_t *zio) zio_ddt_ditto_write_done(zio_t *zio)
{ {
int p = DDT_PHYS_DITTO; int p = DDT_PHYS_DITTO;
zio_prop_t *zp = &zio->io_prop;
blkptr_t *bp = zio->io_bp; blkptr_t *bp = zio->io_bp;
ddt_t *ddt = ddt_select(zio->io_spa, bp); ddt_t *ddt = ddt_select(zio->io_spa, bp);
ddt_entry_t *dde = zio->io_private; ddt_entry_t *dde = zio->io_private;
ddt_phys_t *ddp = &dde->dde_phys[p]; ddt_phys_t *ddp = &dde->dde_phys[p];
ddt_key_t *ddk = &dde->dde_key; ddt_key_t *ddk = &dde->dde_key;
ASSERTV(zio_prop_t *zp = &zio->io_prop);
ddt_enter(ddt); ddt_enter(ddt);