diff --git a/config/Rules.am b/config/Rules.am index 175e4b6087..3c22bb8443 100644 --- a/config/Rules.am +++ b/config/Rules.am @@ -1,12 +1,7 @@ DEFAULT_INCLUDES = -I${top_srcdir} -# FIXME: Quiet warnings not covered by the gcc-* patches. We should -# FIXME: consider removing this as soon as we reasonably can. -# # FIXME: Add -Wshadow once everything is working -# -AM_CFLAGS = -Wall -Wstrict-prototypes -Werror -AM_CFLAGS += -Wno-switch -Wno-unused -Wno-missing-braces +AM_CFLAGS = -Wall -Wstrict-prototypes -Werror -Wno-switch AM_CFLAGS += -Wno-uninitialized -fno-strict-aliasing # Expected defines not covered by zfs_config.h or spl_config.h diff --git a/config/kernel.m4 b/config/kernel.m4 index 245bdc00de..e1cd0b90cf 100644 --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -6,15 +6,12 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [ dnl # KERNELMAKE_PARAMS="V=1" # Enable verbose module build KERNELMAKE_PARAMS= - # FIXME: Quiet warnings not covered by the gcc-* patches. We should - # FIXME: consider removing this as soon as we reasonably can KERNELCPPFLAGS="$KERNELCPPFLAGS -Wall -Wstrict-prototypes -Werror" - KERNELCPPFLAGS="$KERNELCPPFLAGS -Wno-switch -Wno-unused" - KERNELCPPFLAGS="$KERNELCPPFLAGS -Wno-missing-braces" + KERNELCPPFLAGS="$KERNELCPPFLAGS -Wno-switch" KERNELCPPFLAGS="$KERNELCPPFLAGS -Wno-uninitialized -fno-strict-aliasing" - KERNELCPPFLAGS="$KERNELCPPFLAGS -DHAVE_SPL -D_KERNEL " - KERNELCPPFLAGS="$KERNELCPPFLAGS -DTEXT_DOMAIN=\\\"zfs-linux-kernel\\\" " + KERNELCPPFLAGS="$KERNELCPPFLAGS -DHAVE_SPL -D_KERNEL" + KERNELCPPFLAGS="$KERNELCPPFLAGS -DTEXT_DOMAIN=\\\"zfs-linux-kernel\\\"" KERNELCPPFLAGS="$KERNELCPPFLAGS -I$splsrc -I$splsrc/include -I$TOPDIR" diff --git a/module/zfs/arc.c b/module/zfs/arc.c index a8c3389c3a..b7278822bb 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -1854,9 +1854,8 @@ arc_shrink(void) static int arc_reclaim_needed(void) { - uint64_t extra; - #ifdef _KERNEL + uint64_t extra; if (needfree) return (1); @@ -2515,7 +2514,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 ab523d4f68..e6d7400c35 100644 --- a/module/zfs/dbuf.c +++ b/module/zfs/dbuf.c @@ -323,12 +323,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 */ @@ -344,7 +344,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); @@ -356,7 +355,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))); } } } @@ -369,11 +370,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 ea2bcb9402..52373e8b63 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 5aa5be88b6..f2ff551860 100644 --- a/module/zfs/dmu_objset.c +++ b/module/zfs/dmu_objset.c @@ -862,7 +862,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 a7a7a7f226..e731aa3bfb 100644 --- a/module/zfs/dsl_dataset.c +++ b/module/zfs/dsl_dataset.c @@ -1702,7 +1702,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 1ec801130d..5a34ed29fd 100644 --- a/module/zfs/spa.c +++ b/module/zfs/spa.c @@ -2897,7 +2897,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; @@ -3015,7 +3014,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); @@ -3034,7 +3033,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); @@ -3093,7 +3092,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 = 0; @@ -3238,7 +3236,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 0c3ca95115..e8dbd9f5a6 100644 --- a/module/zfs/vdev.c +++ b/module/zfs/vdev.c @@ -1221,9 +1221,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 070ac73921..d37c9f80a8 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 2f0fef10bc..2384e40cbf 100644 --- a/module/zfs/zio.c +++ b/module/zfs/zio.c @@ -1529,7 +1529,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; @@ -1541,7 +1540,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));