From 152004c1eb4f179b1216d4bb7e24154bdb71ad14 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 5 Dec 2008 09:21:43 -0800 Subject: [PATCH] Refresh gcc-unused branch --- .topdeps | 1 + .topmsg | 6 ++++++ zfs/lib/libzpool/dbuf.c | 15 ++++++--------- zfs/lib/libzpool/dnode.c | 6 +++++- zfs/lib/libzpool/dnode_sync.c | 4 ++++ zfs/lib/libzpool/dsl_dataset.c | 6 ++---- zfs/lib/libzpool/dsl_dir.c | 3 +-- zfs/lib/libzpool/dsl_prop.c | 2 +- zfs/lib/libzpool/vdev.c | 3 +-- zfs/lib/libzpool/vdev_cache.c | 3 +-- 10 files changed, 28 insertions(+), 21 deletions(-) create mode 100644 .topdeps create mode 100644 .topmsg diff --git a/.topdeps b/.topdeps new file mode 100644 index 0000000000..1f7391f92b --- /dev/null +++ b/.topdeps @@ -0,0 +1 @@ +master diff --git a/.topmsg b/.topmsg new file mode 100644 index 0000000000..ab4f41c43e --- /dev/null +++ b/.topmsg @@ -0,0 +1,6 @@ +From: Brian Behlendorf +Subject: [PATCH] gcc-unused + +Gcc -Wall warn: 'unused variable' + +Signed-off-by: Brian Behlendorf diff --git a/zfs/lib/libzpool/dbuf.c b/zfs/lib/libzpool/dbuf.c index d04610317a..7c65c95a82 100644 --- a/zfs/lib/libzpool/dbuf.c +++ b/zfs/lib/libzpool/dbuf.c @@ -1736,8 +1736,7 @@ dbuf_create_bonus(dnode_t *dn) 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 @@ -2326,17 +2325,15 @@ dbuf_write_done(zio_t *zio, arc_buf_t *buf, void *vdb) 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_phys->dn_indblkshift); + ASSERT3U(db->db.db_size, ==, + 1<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); diff --git a/zfs/lib/libzpool/dnode.c b/zfs/lib/libzpool/dnode.c index e77834d60d..d0b47d786b 100644 --- a/zfs/lib/libzpool/dnode.c +++ b/zfs/lib/libzpool/dnode.c @@ -40,7 +40,9 @@ static int free_range_compar(const void *node1, const void *node2); 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; @@ -518,11 +520,12 @@ dnode_buf_pageout(dmu_buf_t *db, void *arg) 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 @@ -535,6 +538,7 @@ dnode_buf_pageout(dmu_buf_t *db, void *arg) for (n = 0; n < TXG_SIZE; n++) ASSERT(!list_link_active(&dn->dn_dirty_link[n])); + } #endif children_dnodes[i] = NULL; dnode_destroy(dn); diff --git a/zfs/lib/libzpool/dnode_sync.c b/zfs/lib/libzpool/dnode_sync.c index 779cfc96f9..3ead08de29 100644 --- a/zfs/lib/libzpool/dnode_sync.c +++ b/zfs/lib/libzpool/dnode_sync.c @@ -319,8 +319,10 @@ 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) { +#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 || @@ -349,8 +351,10 @@ dnode_sync_free_range(dnode_t *dn, uint64_t blkid, uint64_t nblks, dmu_tx_t *tx) 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 || diff --git a/zfs/lib/libzpool/dsl_dataset.c b/zfs/lib/libzpool/dsl_dataset.c index 93ea8aa111..c0bd82d1bb 100644 --- a/zfs/lib/libzpool/dsl_dataset.c +++ b/zfs/lib/libzpool/dsl_dataset.c @@ -1995,10 +1995,8 @@ 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; - - 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 > diff --git a/zfs/lib/libzpool/dsl_dir.c b/zfs/lib/libzpool/dsl_dir.c index 48d87f97f6..8c23d52e33 100644 --- a/zfs/lib/libzpool/dsl_dir.c +++ b/zfs/lib/libzpool/dsl_dir.c @@ -48,11 +48,10 @@ static void 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); } diff --git a/zfs/lib/libzpool/dsl_prop.c b/zfs/lib/libzpool/dsl_prop.c index 212acbbc59..bb19f3e9e8 100644 --- a/zfs/lib/libzpool/dsl_prop.c +++ b/zfs/lib/libzpool/dsl_prop.c @@ -370,7 +370,7 @@ dsl_prop_set_sync(void *arg1, void *arg2, cred_t *cr, dmu_tx_t *tx) 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)); diff --git a/zfs/lib/libzpool/vdev.c b/zfs/lib/libzpool/vdev.c index 16a27e514a..d73b6c5816 100644 --- a/zfs/lib/libzpool/vdev.c +++ b/zfs/lib/libzpool/vdev.c @@ -1414,8 +1414,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); diff --git a/zfs/lib/libzpool/vdev_cache.c b/zfs/lib/libzpool/vdev_cache.c index 5a7b59f6ed..cad0438c34 100644 --- a/zfs/lib/libzpool/vdev_cache.c +++ b/zfs/lib/libzpool/vdev_cache.c @@ -253,7 +253,6 @@ 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); zio_t *fio; ASSERT(zio->io_type == ZIO_TYPE_READ); @@ -270,7 +269,7 @@ vdev_cache_read(zio_t *zio) 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);