diff options
author | pjd <pjd@FreeBSD.org> | 2007-04-24 16:57:53 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2007-04-24 16:57:53 +0000 |
commit | 732835bdb29be7a3c9bc1e00ab38396a5c3a86f5 (patch) | |
tree | f2582897a7c88233bf5accf729e00e4adce24070 /sys/contrib | |
parent | e68258363d7b6c144bfb0cd0ceee39cf14676975 (diff) | |
download | FreeBSD-src-732835bdb29be7a3c9bc1e00ab38396a5c3a86f5.zip FreeBSD-src-732835bdb29be7a3c9bc1e00ab38396a5c3a86f5.tar.gz |
MFp4: Rearange the code so vobject is destroyed from reclaim() method like
in all other file system on FreeBSD (instead from inactive() method).
A nice side-effect of this change, except that it speedups file system
when mmaped file are often open/closed, is that it makes FreeBSD's
namecache work:)
Diffstat (limited to 'sys/contrib')
-rw-r--r-- | sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c | 39 | ||||
-rw-r--r-- | sys/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c | 4 |
2 files changed, 22 insertions, 21 deletions
diff --git a/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c b/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c index 2d15481..d434cfc 100644 --- a/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c +++ b/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c @@ -3400,11 +3400,6 @@ zfs_freebsd_inactive(ap) { vnode_t *vp = ap->a_vp; - /* - * Destroy the vm object and flush associated pages. - */ - vnode_destroy_vobject(vp); - zfs_inactive(vp, ap->a_td->td_ucred); return (0); } @@ -3416,28 +3411,38 @@ zfs_freebsd_reclaim(ap) struct thread *a_td; } */ *ap; { - vnode_t *vp = ap->a_vp; + vnode_t *vp = ap->a_vp; znode_t *zp = VTOZ(vp); + zfsvfs_t *zfsvfs; + int rele = 1; + + ASSERT(zp != NULL); - if (zp != NULL) - mutex_enter(&zp->z_lock); -#if 0 /* - * We do it from zfs_inactive(), because after zfs_inactive() we can't - * VOP_WRITE() to the vnode. - */ /* * Destroy the vm object and flush associated pages. */ vnode_destroy_vobject(vp); -#endif + + mutex_enter(&zp->z_lock); + ASSERT(zp->z_phys); + ASSERT(zp->z_dbuf_held); + zfsvfs = zp->z_zfsvfs; + if (!zp->z_unlinked) { + zp->z_dbuf_held = 0; + ZTOV(zp) = NULL; + mutex_exit(&zp->z_lock); + dmu_buf_rele(zp->z_dbuf, NULL); + } else { + mutex_exit(&zp->z_lock); + } VI_LOCK(vp); + if (vp->v_count > 0) + rele = 0; vp->v_data = NULL; - if (zp != NULL) - zp->z_vnode = NULL; ASSERT(vp->v_holdcnt > 1); vdropl(vp); - if (zp != NULL) - mutex_exit(&zp->z_lock); + if (!zp->z_unlinked && rele) + VFS_RELE(zfsvfs->z_vfs); return (0); } diff --git a/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c b/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c index 966f503..9bb8ad0 100644 --- a/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c +++ b/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c @@ -683,12 +683,8 @@ zfs_zinactive(znode_t *zp) } ASSERT(zp->z_phys); ASSERT(zp->z_dbuf_held); - - zp->z_dbuf_held = 0; mutex_exit(&zp->z_lock); - dmu_buf_rele(zp->z_dbuf, NULL); ZFS_OBJ_HOLD_EXIT(zfsvfs, z_id); - VFS_RELE(zfsvfs->z_vfs); } /* |