diff options
author | jasone <jasone@FreeBSD.org> | 2000-10-04 01:29:17 +0000 |
---|---|---|
committer | jasone <jasone@FreeBSD.org> | 2000-10-04 01:29:17 +0000 |
commit | 4e290e67b7310d906f113850fddfdf1017a9d15b (patch) | |
tree | bae3e99c848c6e38aee34a7cf61ffa9ca55b0095 /sys/fs/hpfs | |
parent | bea51a4aa1bf67a183bd1d4a6227fa891345af60 (diff) | |
download | FreeBSD-src-4e290e67b7310d906f113850fddfdf1017a9d15b.zip FreeBSD-src-4e290e67b7310d906f113850fddfdf1017a9d15b.tar.gz |
Convert lockmgr locks from using simple locks to using mutexes.
Add lockdestroy() and appropriate invocations, which corresponds to
lockinit() and must be called to clean up after a lockmgr lock is no
longer needed.
Diffstat (limited to 'sys/fs/hpfs')
-rw-r--r-- | sys/fs/hpfs/hpfs.h | 1 | ||||
-rw-r--r-- | sys/fs/hpfs/hpfs_hash.c | 14 | ||||
-rw-r--r-- | sys/fs/hpfs/hpfs_vfsops.c | 13 | ||||
-rw-r--r-- | sys/fs/hpfs/hpfs_vnops.c | 2 |
4 files changed, 28 insertions, 2 deletions
diff --git a/sys/fs/hpfs/hpfs.h b/sys/fs/hpfs/hpfs.h index 7c880b2..be12791 100644 --- a/sys/fs/hpfs/hpfs.h +++ b/sys/fs/hpfs/hpfs.h @@ -414,6 +414,7 @@ extern vop_t ** hpfs_vnodeop_p; /* Hash routines, too small to be separate header */ void hpfs_hphashinit __P((void)); +void hpfs_hphashdestroy __P((void)); struct hpfsnode *hpfs_hphashlookup __P((dev_t, lsn_t)); struct hpfsnode *hpfs_hphashget __P((dev_t, lsn_t)); struct vnode *hpfs_hphashvget __P((dev_t, lsn_t, struct proc *)); diff --git a/sys/fs/hpfs/hpfs_hash.c b/sys/fs/hpfs/hpfs_hash.c index a948ade..450711c 100644 --- a/sys/fs/hpfs/hpfs_hash.c +++ b/sys/fs/hpfs/hpfs_hash.c @@ -43,6 +43,8 @@ #include <sys/malloc.h> #include <sys/proc.h> +#include <machine/mutex.h> + #include <fs/hpfs/hpfs.h> MALLOC_DEFINE(M_HPFSHASH, "HPFS hash", "HPFS node hash tables"); @@ -72,6 +74,16 @@ hpfs_hphashinit() } /* + * Destroy inode hash table. + */ +void +hpfs_hphashdestroy(void) +{ + + lockdestroy(&hpfs_hphash_lock); +} + +/* * Use the device/inum pair to find the incore inode, and return a pointer * to it. If it is in core, return it, even if it is locked. */ @@ -126,7 +138,7 @@ loop: for (hp = HPNOHASH(dev, ino)->lh_first; hp; hp = hp->h_hash.le_next) { if (ino == hp->h_no && dev == hp->h_dev) { vp = HPTOV(hp); - simple_lock (&vp->v_interlock); + mtx_enter(&vp->v_interlock, MTX_DEF); simple_unlock (&hpfs_hphash_slock); if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, p)) goto loop; diff --git a/sys/fs/hpfs/hpfs_vfsops.c b/sys/fs/hpfs/hpfs_vfsops.c index 0bb10dd..1906799 100644 --- a/sys/fs/hpfs/hpfs_vfsops.c +++ b/sys/fs/hpfs/hpfs_vfsops.c @@ -87,6 +87,7 @@ struct sockaddr; static int hpfs_mount __P((struct mount *, char *, caddr_t, struct nameidata *, struct proc *)); static int hpfs_init __P((struct vfsconf *)); +static int hpfs_uninit __P((struct vfsconf *)); static int hpfs_checkexp __P((struct mount *, struct sockaddr *, int *, struct ucred **)); #else /* defined(__NetBSD__) */ @@ -169,6 +170,16 @@ hpfs_init () #endif } +#if defined(__FreeBSD__) +static int +hpfs_uninit (vfsp) + struct vfsconf *vfsp; +{ + hpfs_hphashdestroy(); + return 0;; +} +#endif + static int hpfs_mount ( struct mount *mp, @@ -737,7 +748,7 @@ static struct vfsops hpfs_vfsops = { hpfs_checkexp, hpfs_vptofh, hpfs_init, - vfs_stduninit, + hpfs_uninit, vfs_stdextattrctl, }; VFS_SET(hpfs_vfsops, hpfs, 0); diff --git a/sys/fs/hpfs/hpfs_vnops.c b/sys/fs/hpfs/hpfs_vnops.c index dcfd2cf..f1b0b2ce 100644 --- a/sys/fs/hpfs/hpfs_vnops.c +++ b/sys/fs/hpfs/hpfs_vnops.c @@ -698,6 +698,8 @@ hpfs_reclaim(ap) hp->h_devvp = NULL; } + lockdestroy(&hp->hlock); + vp->v_data = NULL; FREE(hp, M_HPFSNO); |