From ecd2dbcb441f747567cb155f62606537c491a8be Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 11 Mar 2009 22:07:25 -0700 Subject: [PATCH 1/3] 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. --- module/zfs/arc.c | 5 ++--- module/zfs/dbuf.c | 12 ++++++------ module/zfs/dmu.c | 6 ++---- module/zfs/dmu_objset.c | 2 +- module/zfs/dsl_dataset.c | 2 +- module/zfs/spa.c | 8 +++----- module/zfs/vdev.c | 5 ++--- module/zfs/zap_micro.c | 4 ++-- module/zfs/zio.c | 3 +-- 9 files changed, 20 insertions(+), 27 deletions(-) diff --git a/module/zfs/arc.c b/module/zfs/arc.c index 3a9598a926..0b19cf921c 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -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); } diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c index 78dc0e9216..b17f884e06 100644 --- a/module/zfs/dbuf.c +++ b/module/zfs/dbuf.c @@ -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); } } } diff --git a/module/zfs/dmu.c b/module/zfs/dmu.c index b6205bd500..9963e726c4 100644 --- a/module/zfs/dmu.c +++ b/module/zfs/dmu.c @@ -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; } diff --git a/module/zfs/dmu_objset.c b/module/zfs/dmu_objset.c index c9e00d5115..923f0c9928 100644 --- a/module/zfs/dmu_objset.c +++ b/module/zfs/dmu_objset.c @@ -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, diff --git a/module/zfs/dsl_dataset.c b/module/zfs/dsl_dataset.c index 3e87106fa0..e568351435 100644 --- a/module/zfs/dsl_dataset.c +++ b/module/zfs/dsl_dataset.c @@ -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)); diff --git a/module/zfs/spa.c b/module/zfs/spa.c index df1b7e1252..43c9a19e85 100644 --- a/module/zfs/spa.c +++ b/module/zfs/spa.c @@ -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. diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c index 01c6ee3ae9..f7c1135c51 100644 --- a/module/zfs/vdev.c +++ b/module/zfs/vdev.c @@ -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); diff --git a/module/zfs/zap_micro.c b/module/zfs/zap_micro.c index abba42775b..aa8e461262 100644 --- a/module/zfs/zap_micro.c +++ b/module/zfs/zap_micro.c @@ -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 diff --git a/module/zfs/zio.c b/module/zfs/zio.c index a669ad64a0..987e47bb19 100644 --- a/module/zfs/zio.c +++ b/module/zfs/zio.c @@ -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)); From 81ab9b8f4ccde2f437da7843c1c2a51025f0055b Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 11 Mar 2009 22:20:13 -0700 Subject: [PATCH 2/3] Update .topmsg for consistent with with gcc topic branches --- .topmsg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.topmsg b/.topmsg index 81bb126e8b..c6d4e21f3d 100644 --- a/.topmsg +++ b/.topmsg @@ -1,3 +1,4 @@ From: Ricardo M. Correia -Subject: Add 'ull' suffix to 64-bit constants. +Subject: [PATCH] gcc 64-bit constants +Add 'ull' suffix to 64-bit constants. From 7cd5698618f84cf2ec6dfe6d53f304bcf62de13a Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 11 Mar 2009 22:22:01 -0700 Subject: [PATCH 3/3] Update .topmsg for consistent with with gcc topic branches --- .topmsg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.topmsg b/.topmsg index 4a2676d04f..6dacb198a2 100644 --- a/.topmsg +++ b/.topmsg @@ -1,3 +1,4 @@ From: Ricardo M. Correia -Subject: Added 'gcc-ident-pragmas' branch. +Subject: [PATCH] gcc ident pragmas +Remove all ident pragmas which are unknown to gcc.