- Add missing lock destruction and remove duplicate initializations.

With this change it is possible to unload zfs.ko module from
  WITNESS-enabled kernel.
- Remove bogus comment.
This commit is contained in:
Pawel Jakub Dawidek 2007-05-06 19:05:37 +00:00
parent 5b93d33118
commit 6a7309390f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=169325
12 changed files with 28 additions and 10 deletions

View File

@ -1178,7 +1178,8 @@ dbuf_undirty(dmu_buf_impl_t *db, dmu_tx_t *tx)
} else {
ASSERT(db->db_buf != NULL);
ASSERT(list_head(&dr->dt.di.dr_children) == NULL);
/* XXX - mutex and list destroy? */
list_destroy(&dr->dt.di.dr_children);
mutex_destroy(&dr->dt.di.dr_mtx);
}
kmem_free(dr, sizeof (dbuf_dirty_record_t));
@ -1925,6 +1926,10 @@ dbuf_sync_leaf(dbuf_dirty_record_t *dr, dmu_tx_t *tx)
drp = &(*drp)->dr_next;
ASSERT((*drp)->dr_next == NULL);
*drp = NULL;
if (dr->dr_dbuf->db_level != 0) {
list_destroy(&dr->dt.di.dr_children);
mutex_destroy(&dr->dt.di.dr_mtx);
}
kmem_free(dr, sizeof (dbuf_dirty_record_t));
ASSERT(db->db_dirtycnt > 0);
db->db_dirtycnt -= 1;
@ -2225,6 +2230,8 @@ dbuf_write_done(zio_t *zio, arc_buf_t *buf, void *vdb)
>> (db->db_level * epbs), >=, db->db_blkid);
arc_set_callback(db->db_buf, dbuf_do_evict, db);
}
list_destroy(&dr->dt.di.dr_children);
mutex_destroy(&dr->dt.di.dr_mtx);
}
kmem_free(dr, sizeof (dbuf_dirty_record_t));

View File

@ -260,7 +260,6 @@ dnode_create(objset_impl_t *os, dnode_phys_t *dnp, dmu_buf_impl_t *db,
uint64_t object)
{
dnode_t *dn = kmem_cache_alloc(dnode_cache, KM_SLEEP);
(void) dnode_cons(dn, NULL, 0); /* XXX */
dn->dn_objset = os;
dn->dn_object = object;

View File

@ -445,6 +445,8 @@ dnode_undirty_dbufs(list_t *list)
} else {
mutex_exit(&db->db_mtx);
dnode_undirty_dbufs(&dr->dt.di.dr_children);
list_destroy(&dr->dt.di.dr_children);
mutex_destroy(&dr->dt.di.dr_mtx);
}
kmem_free(dr, sizeof (dbuf_dirty_record_t));
dbuf_rele(db, (void *)(uintptr_t)txg);

View File

@ -129,6 +129,7 @@ dsl_pool_close(dsl_pool_t *dp)
txg_list_destroy(&dp->dp_dirty_datasets);
txg_list_destroy(&dp->dp_dirty_dirs);
txg_list_destroy(&dp->dp_sync_tasks);
list_destroy(&dp->dp_synced_objsets);
arc_flush();

View File

@ -695,9 +695,6 @@ zfs_zinactive(znode_t *zp)
ZFS_OBJ_HOLD_EXIT(zfsvfs, z_id);
}
/*
* FreeBSD: Should be called from ->vop_reclaim().
*/
void
zfs_znode_free(znode_t *zp)
{
@ -991,6 +988,7 @@ zfs_create_fs(objset_t *os, cred_t *cr, dmu_tx_t *tx)
error = zap_add(os, moid, ZFS_ROOT_OBJ, 8, 1, &roid, tx);
ASSERT(error == 0);
mutex_destroy(&zfsvfs.z_znodes_lock);
kmem_cache_free(znode_cache, rootzp);
}
#endif /* _KERNEL */

View File

@ -977,6 +977,8 @@ zio_done(zio_t *zio)
cv_broadcast(&zio->io_cv);
mutex_exit(&zio->io_lock);
} else {
cv_destroy(&zio->io_cv);
mutex_destroy(&zio->io_lock);
kmem_cache_free(zio_cache, zio);
}
}

View File

@ -1178,7 +1178,8 @@ dbuf_undirty(dmu_buf_impl_t *db, dmu_tx_t *tx)
} else {
ASSERT(db->db_buf != NULL);
ASSERT(list_head(&dr->dt.di.dr_children) == NULL);
/* XXX - mutex and list destroy? */
list_destroy(&dr->dt.di.dr_children);
mutex_destroy(&dr->dt.di.dr_mtx);
}
kmem_free(dr, sizeof (dbuf_dirty_record_t));
@ -1925,6 +1926,10 @@ dbuf_sync_leaf(dbuf_dirty_record_t *dr, dmu_tx_t *tx)
drp = &(*drp)->dr_next;
ASSERT((*drp)->dr_next == NULL);
*drp = NULL;
if (dr->dr_dbuf->db_level != 0) {
list_destroy(&dr->dt.di.dr_children);
mutex_destroy(&dr->dt.di.dr_mtx);
}
kmem_free(dr, sizeof (dbuf_dirty_record_t));
ASSERT(db->db_dirtycnt > 0);
db->db_dirtycnt -= 1;
@ -2225,6 +2230,8 @@ dbuf_write_done(zio_t *zio, arc_buf_t *buf, void *vdb)
>> (db->db_level * epbs), >=, db->db_blkid);
arc_set_callback(db->db_buf, dbuf_do_evict, db);
}
list_destroy(&dr->dt.di.dr_children);
mutex_destroy(&dr->dt.di.dr_mtx);
}
kmem_free(dr, sizeof (dbuf_dirty_record_t));

View File

@ -260,7 +260,6 @@ dnode_create(objset_impl_t *os, dnode_phys_t *dnp, dmu_buf_impl_t *db,
uint64_t object)
{
dnode_t *dn = kmem_cache_alloc(dnode_cache, KM_SLEEP);
(void) dnode_cons(dn, NULL, 0); /* XXX */
dn->dn_objset = os;
dn->dn_object = object;

View File

@ -445,6 +445,8 @@ dnode_undirty_dbufs(list_t *list)
} else {
mutex_exit(&db->db_mtx);
dnode_undirty_dbufs(&dr->dt.di.dr_children);
list_destroy(&dr->dt.di.dr_children);
mutex_destroy(&dr->dt.di.dr_mtx);
}
kmem_free(dr, sizeof (dbuf_dirty_record_t));
dbuf_rele(db, (void *)(uintptr_t)txg);

View File

@ -129,6 +129,7 @@ dsl_pool_close(dsl_pool_t *dp)
txg_list_destroy(&dp->dp_dirty_datasets);
txg_list_destroy(&dp->dp_dirty_dirs);
txg_list_destroy(&dp->dp_sync_tasks);
list_destroy(&dp->dp_synced_objsets);
arc_flush();

View File

@ -695,9 +695,6 @@ zfs_zinactive(znode_t *zp)
ZFS_OBJ_HOLD_EXIT(zfsvfs, z_id);
}
/*
* FreeBSD: Should be called from ->vop_reclaim().
*/
void
zfs_znode_free(znode_t *zp)
{
@ -991,6 +988,7 @@ zfs_create_fs(objset_t *os, cred_t *cr, dmu_tx_t *tx)
error = zap_add(os, moid, ZFS_ROOT_OBJ, 8, 1, &roid, tx);
ASSERT(error == 0);
mutex_destroy(&zfsvfs.z_znodes_lock);
kmem_cache_free(znode_cache, rootzp);
}
#endif /* _KERNEL */

View File

@ -977,6 +977,8 @@ zio_done(zio_t *zio)
cv_broadcast(&zio->io_cv);
mutex_exit(&zio->io_lock);
} else {
cv_destroy(&zio->io_cv);
mutex_destroy(&zio->io_lock);
kmem_cache_free(zio_cache, zio);
}
}