Skip to content

Commit

Permalink
Fix gcc unused variable warnings
Browse files Browse the repository at this point in the history
Gcc -Wall warn: 'unused variable'

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
  • Loading branch information
behlendorf committed Aug 31, 2010
1 parent c65aa5b commit 1fde1e3
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 38 deletions.
2 changes: 1 addition & 1 deletion cmd/zpool/zpool_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion cmd/ztest/ztest.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions module/zfs/arc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions module/zfs/dbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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++) {
Expand Down Expand Up @@ -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);
}

/*
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion module/zfs/dnode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions module/zfs/dnode_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand Down Expand Up @@ -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 ||
Expand Down Expand Up @@ -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);
Expand Down
10 changes: 4 additions & 6 deletions module/zfs/dsl_dataset.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion module/zfs/dsl_dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
8 changes: 4 additions & 4 deletions module/zfs/sa.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions module/zfs/spa.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions module/zfs/vdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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++)
Expand Down
2 changes: 1 addition & 1 deletion module/zfs/vdev_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions module/zfs/zap_micro.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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).
Expand Down
4 changes: 2 additions & 2 deletions module/zfs/zio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 1fde1e3

Please sign in to comment.