Merge commit 'refs/top-bases/linux-unused' into linux-unused

This commit is contained in:
Brian Behlendorf 2009-07-09 12:28:15 -07:00
commit 5317697272
15 changed files with 54 additions and 47 deletions

View File

@ -1163,7 +1163,7 @@ ztest_vdev_attach_detach(ztest_args_t *za)
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

@ -1560,7 +1560,7 @@ nvlist_lookup_nvpair_ei_sep(nvlist_t *nvl, const char *name, const char sep,
{ {
nvpair_t *nvp; nvpair_t *nvp;
const char *np; const char *np;
char *sepp = NULL; char *sepp;
char *idxp, *idxep; char *idxp, *idxep;
nvlist_t **nva; nvlist_t **nva;
long idx = 0; long idx = 0;

View File

@ -323,12 +323,12 @@ dbuf_verify(dmu_buf_impl_t *db)
* dnode_set_blksz(). * dnode_set_blksz().
*/ */
if (db->db_level == 0 && db->db.db_object == DMU_META_DNODE_OBJECT) { if (db->db_level == 0 && db->db.db_object == DMU_META_DNODE_OBJECT) {
ASSERTV(dbuf_dirty_record_t *dr = db->db_data_pending);
/* /*
* It should only be modified in syncing context, so * It should only be modified in syncing context, so
* make sure we only have one copy of the data. * make sure we only have one copy of the data.
*/ */
ASSERT(db->db_data_pending == NULL || ASSERT(dr == NULL || dr->dt.dl.dr_data == db->db_buf);
db->db_data_pending->dt.dl.dr_data == db->db_buf);
} }
/* verify db->db_blkptr */ /* verify db->db_blkptr */
@ -344,6 +344,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 */
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);
@ -355,9 +357,7 @@ dbuf_verify(dmu_buf_impl_t *db)
if (RW_WRITE_HELD(&db->db_dnode->dn_struct_rwlock)) { if (RW_WRITE_HELD(&db->db_dnode->dn_struct_rwlock)) {
ASSERT3P(db->db_blkptr, ==, ASSERT3P(db->db_blkptr, ==,
((blkptr_t *)db->db_parent->db.db_data + ((blkptr_t *)db->db_parent->db.db_data +
db->db_blkid % db->db_blkid % epb));
(db->db_parent->db.db_size >>
SPA_BLKPTRSHIFT)));
} }
} }
} }
@ -370,10 +370,11 @@ 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) {
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++) {
ASSERT(((uint64_t *)db->db.db_data)[i] == 0); ASSERT(buf[i] == 0);
} }
} }
} }
@ -1801,7 +1802,8 @@ dbuf_create_bonus(dnode_t *dn)
void void
dbuf_add_ref(dmu_buf_impl_t *db, void *tag) dbuf_add_ref(dmu_buf_impl_t *db, void *tag)
{ {
VERIFY(refcount_add(&db->db_holds, tag) > 1); ASSERTV(int64_t holds = refcount_add(&db->db_holds, tag));
ASSERT(holds > 1);
} }
#pragma weak dmu_buf_rele = dbuf_rele #pragma weak dmu_buf_rele = dbuf_rele
@ -2407,15 +2409,17 @@ dbuf_write_done(zio_t *zio, arc_buf_t *buf, void *vdb)
ASSERT(arc_released(db->db_buf)); ASSERT(arc_released(db->db_buf));
} }
} else { } else {
ASSERTV(dnode_t *dn = db->db_dnode);
ASSERT(list_head(&dr->dt.di.dr_children) == NULL); ASSERT(list_head(&dr->dt.di.dr_children) == NULL);
ASSERT3U(db->db.db_size, ==, ASSERT3U(db->db.db_size, ==, 1<<dn->dn_phys->dn_indblkshift);
1<<db->db_dnode->dn_phys->dn_indblkshift);
if (!BP_IS_HOLE(db->db_blkptr)) { if (!BP_IS_HOLE(db->db_blkptr)) {
ASSERTV(int epbs = dn->dn_phys->dn_indblkshift -
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(db->db_dnode->dn_phys->dn_maxblkid >> (db->db_level * ASSERT3U(dn->dn_phys->dn_maxblkid
(db->db_dnode->dn_phys->dn_indblkshift - SPA_BLKPTRSHIFT)), >> (db->db_level * epbs), >=, db->db_blkid);
>=, db->db_blkid);
arc_set_callback(db->db_buf, dbuf_do_evict, db); arc_set_callback(db->db_buf, dbuf_do_evict, db);
} }
mutex_destroy(&dr->dt.di.dr_mtx); mutex_destroy(&dr->dt.di.dr_mtx);

View File

@ -879,8 +879,10 @@ dmu_sync_ready(zio_t *zio, arc_buf_t *buf, void *varg)
blkptr_t *bp = zio->io_bp; blkptr_t *bp = zio->io_bp;
if (!BP_IS_HOLE(bp)) { if (!BP_IS_HOLE(bp)) {
ASSERT(BP_GET_TYPE(bp) == ((dmu_sync_arg_t *) ASSERTV(dmu_sync_arg_t *in = varg);
varg)->dr->dr_dbuf->db_dnode->dn_type); ASSERTV(dbuf_dirty_record_t *dr = in->dr);
ASSERTV(dmu_buf_impl_t *db = dr->dr_dbuf);
ASSERT(BP_GET_TYPE(bp) == db->db_dnode->dn_type);
ASSERT(BP_GET_LEVEL(bp) == 0); ASSERT(BP_GET_LEVEL(bp) == 0);
bp->blk_fill = 1; bp->blk_fill = 1;
} }

View File

@ -893,9 +893,9 @@ ready(zio_t *zio, arc_buf_t *abuf, void *arg)
int i; int i;
blkptr_t *bp = zio->io_bp; blkptr_t *bp = zio->io_bp;
blkptr_t *bp_orig = &zio->io_bp_orig;
objset_impl_t *os = arg; objset_impl_t *os = arg;
dnode_phys_t *dnp = &os->os_phys->os_meta_dnode; dnode_phys_t *dnp = &os->os_phys->os_meta_dnode;
ASSERTV(blkptr_t *bp_orig = &zio->io_bp_orig);
ASSERT(bp == os->os_rootbp); ASSERT(bp == os->os_rootbp);
ASSERT(BP_GET_TYPE(bp) == DMU_OT_OBJSET); ASSERT(BP_GET_TYPE(bp) == DMU_OT_OBJSET);
@ -912,7 +912,7 @@ ready(zio_t *zio, arc_buf_t *abuf, void *arg)
bp->blk_fill += dnp->dn_blkptr[i].blk_fill; bp->blk_fill += dnp->dn_blkptr[i].blk_fill;
if (zio->io_flags & ZIO_FLAG_IO_REWRITE) { if (zio->io_flags & ZIO_FLAG_IO_REWRITE) {
VERIFY(DVA_EQUAL(BP_IDENTITY(bp), BP_IDENTITY(bp_orig))); ASSERT(DVA_EQUAL(BP_IDENTITY(bp), BP_IDENTITY(bp_orig)));
} else { } else {
if (zio->io_bp_orig.blk_birth == os->os_synctx->tx_txg) if (zio->io_bp_orig.blk_birth == os->os_synctx->tx_txg)
(void) dsl_dataset_block_kill(os->os_dsl_dataset, (void) dsl_dataset_block_kill(os->os_dsl_dataset,
@ -1040,7 +1040,7 @@ dmu_objset_do_userquota_callbacks(objset_impl_t *os, dmu_tx_t *tx)
{ {
dnode_t *dn; dnode_t *dn;
list_t *list = &os->os_synced_dnodes; list_t *list = &os->os_synced_dnodes;
static const char zerobuf[DN_MAX_BONUSLEN] = {0}; ASSERTV(static const char zerobuf[DN_MAX_BONUSLEN] = {0});
ASSERT(list_head(list) == NULL || dmu_objset_userused_enabled(os)); ASSERT(list_head(list) == NULL || dmu_objset_userused_enabled(os));

View File

@ -40,9 +40,7 @@ static int free_range_compar(const void *node1, const void *node2);
static kmem_cache_t *dnode_cache; static kmem_cache_t *dnode_cache;
#ifndef NDEBUG ASSERTV(static dnode_phys_t dnode_phys_zero);
static dnode_phys_t dnode_phys_zero;
#endif
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

@ -317,10 +317,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) {
#ifndef NDEBUG ASSERTV(uint64_t off = (dn->dn_phys->dn_maxblkid + 1) *
uint64_t off = (dn->dn_phys->dn_maxblkid + 1) * (dn->dn_phys->dn_datablkszsec<<SPA_MINBLOCKSHIFT));
(dn->dn_phys->dn_datablkszsec << SPA_MINBLOCKSHIFT);
#endif
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 ||
@ -349,10 +347,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) {
#ifndef NDEBUG ASSERTV(uint64_t off = (dn->dn_phys->dn_maxblkid + 1) *
uint64_t off = (dn->dn_phys->dn_maxblkid + 1) * (dn->dn_phys->dn_datablkszsec << SPA_MINBLOCKSHIFT));
(dn->dn_phys->dn_datablkszsec << SPA_MINBLOCKSHIFT);
#endif
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 ||
@ -522,7 +518,7 @@ 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 }; 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

@ -991,7 +991,7 @@ dsl_dataset_destroy(dsl_dataset_t *ds, void *tag)
*/ */
if (ds->ds_phys->ds_bp.blk_fill == 0 && if (ds->ds_phys->ds_bp.blk_fill == 0 &&
dmu_objset_userused_enabled(os->os)) { dmu_objset_userused_enabled(os->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);
@ -1728,8 +1728,8 @@ dsl_dataset_destroy_sync(void *arg1, void *tag, cred_t *cr, dmu_tx_t *tx)
cr, "dataset = %llu", ds->ds_object); cr, "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);
VERIFY(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,
ds->ds_phys->ds_next_clones_obj, tx)); ds->ds_phys->ds_next_clones_obj, tx));
@ -2030,8 +2030,10 @@ 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)
{ {
ASSERT(RW_LOCK_HELD(&(ds->ds_dir->dd_pool)->dp_config_rwlock) || ASSERTV(dsl_pool_t *dp = ds->ds_dir->dd_pool);
dsl_pool_sync_context(ds->ds_dir->dd_pool));
ASSERT(RW_LOCK_HELD(&dp->dp_config_rwlock) ||
dsl_pool_sync_context(dp));
if (ds->ds_prev == NULL) if (ds->ds_prev == NULL)
return (B_FALSE); return (B_FALSE);
if (ds->ds_phys->ds_bp.blk_birth > if (ds->ds_phys->ds_bp.blk_birth >

View File

@ -48,10 +48,11 @@ 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;
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++) {
ASSERT(!txg_list_member(&dd->dd_pool->dp_dirty_dirs, dd, t)); ASSERT(!txg_list_member(&dp->dp_dirty_dirs, dd, t));
ASSERT(dd->dd_tempreserved[t] == 0); ASSERT(dd->dd_tempreserved[t] == 0);
ASSERT(dd->dd_space_towrite[t] == 0); ASSERT(dd->dd_space_towrite[t] == 0);
} }

View File

@ -368,7 +368,7 @@ dsl_prop_set_sync(void *arg1, void *arg2, cred_t *cr, dmu_tx_t *tx)
if (psa->numints == 0) { if (psa->numints == 0) {
int err = zap_remove(mos, zapobj, psa->name, tx); int err = zap_remove(mos, zapobj, psa->name, tx);
VERIFY(0 == err || ENOENT == err); VERIFY(err == 0 || err == ENOENT);
if (isint) { if (isint) {
VERIFY(0 == dsl_prop_get_ds(ds, VERIFY(0 == dsl_prop_get_ds(ds,
psa->name, 8, 1, &intval, NULL)); psa->name, 8, 1, &intval, NULL));

View File

@ -3004,6 +3004,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, open_txg; uint64_t txg, open_txg;
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;
dmu_tx_t *tx; dmu_tx_t *tx;
@ -3120,7 +3121,7 @@ spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *nvroot, int replacing)
if (pvd->vdev_ops != pvops) if (pvd->vdev_ops != pvops)
pvd = vdev_add_parent(oldvd, pvops); pvd = vdev_add_parent(oldvd, pvops);
ASSERT(pvd->vdev_top->vdev_parent == spa->spa_root_vdev); ASSERT(pvd->vdev_top->vdev_parent == rvd);
ASSERT(pvd->vdev_ops == pvops); ASSERT(pvd->vdev_ops == pvops);
ASSERT(oldvd->vdev_parent == pvd); ASSERT(oldvd->vdev_parent == pvd);
@ -3133,7 +3134,7 @@ spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *nvroot, int replacing)
tvd = newvd->vdev_top; tvd = newvd->vdev_top;
ASSERT(pvd->vdev_top == tvd); ASSERT(pvd->vdev_top == tvd);
ASSERT(tvd->vdev_parent == spa->spa_root_vdev); ASSERT(tvd->vdev_parent == rvd);
vdev_config_dirty(tvd); vdev_config_dirty(tvd);
@ -3195,6 +3196,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;
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 = 0; uint64_t unspare_guid = 0;
@ -3339,7 +3341,7 @@ spa_vdev_detach(spa_t *spa, uint64_t guid, uint64_t pguid, int replace_done)
* may have been the previous top-level vdev. * may have been the previous top-level vdev.
*/ */
tvd = cvd->vdev_top; tvd = cvd->vdev_top;
ASSERT(tvd->vdev_parent == spa->spa_root_vdev); ASSERT(tvd->vdev_parent == rvd);
/* /*
* Reevaluate the parent vdev state. * Reevaluate the parent vdev state.

View File

@ -1252,8 +1252,9 @@ vdev_validate(vdev_t *vd)
void void
vdev_close(vdev_t *vd) vdev_close(vdev_t *vd)
{ {
ASSERT(spa_config_held(vd->vdev_spa, SCL_STATE_ALL, RW_WRITER) == ASSERTV(spa_t *spa = vd->vdev_spa);
SCL_STATE_ALL);
ASSERT(spa_config_held(spa, SCL_STATE_ALL, RW_WRITER) == SCL_STATE_ALL);
vd->vdev_ops->vdev_op_close(vd); vd->vdev_ops->vdev_op_close(vd);

View File

@ -246,6 +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);
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);
@ -262,7 +263,7 @@ vdev_cache_read(zio_t *zio)
if (P2BOUNDARY(zio->io_offset, zio->io_size, VCBS)) if (P2BOUNDARY(zio->io_offset, zio->io_size, VCBS))
return (EXDEV); return (EXDEV);
ASSERT(P2PHASE(zio->io_offset, VCBS) + zio->io_size <= VCBS); ASSERT(cache_phase + zio->io_size <= VCBS);
mutex_enter(&vc->vc_lock); mutex_enter(&vc->vc_lock);

View File

@ -747,8 +747,8 @@ 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++) {
ASSERT(strcmp(zn->zn_name_orij, ASSERTV(mzap_ent_phys_t *mze=&zap->zap_m.zap_phys->mz_chunk[i]);
(&zap->zap_m.zap_phys->mz_chunk[i])->mze_name) != 0); ASSERT(strcmp(zn->zn_name_orij, mze->mze_name) != 0);
} }
#endif #endif

View File

@ -1515,7 +1515,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;