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/ufs | |
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/ufs')
-rw-r--r-- | sys/ufs/ffs/ffs_vfsops.c | 14 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_extattr.c | 1 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_ihash.c | 6 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_inode.c | 1 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_quota.c | 2 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_vnops.c | 14 |
6 files changed, 23 insertions, 15 deletions
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 6806734..ea6ef69 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -51,6 +51,8 @@ #include <sys/disklabel.h> #include <sys/malloc.h> +#include <machine/mutex.h> + #include <ufs/ufs/extattr.h> #include <ufs/ufs/quota.h> #include <ufs/ufs/ufsmount.h> @@ -394,7 +396,7 @@ ffs_reload(mp, cred, p) if (devvp->v_tag != VT_MFS && vn_isdisk(devvp, NULL)) { vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); vfs_object_create(devvp, p, p->p_ucred); - simple_lock(&devvp->v_interlock); + mtx_enter(&devvp->v_interlock, MTX_DEF); VOP_UNLOCK(devvp, LK_INTERLOCK, p); } @@ -469,7 +471,7 @@ loop: /* * Step 5: invalidate all cached file data. */ - simple_lock(&vp->v_interlock); + mtx_enter(&vp->v_interlock, MTX_DEF); simple_unlock(&mntvnode_slock); if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, p)) { goto loop; @@ -551,7 +553,7 @@ ffs_mountfs(devvp, mp, p, malloctype) if (devvp->v_tag != VT_MFS && vn_isdisk(devvp, NULL)) { vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); vfs_object_create(devvp, p, cred); - simple_lock(&devvp->v_interlock); + mtx_enter(&devvp->v_interlock, MTX_DEF); VOP_UNLOCK(devvp, LK_INTERLOCK, p); } @@ -933,13 +935,13 @@ loop: */ if (vp->v_mount != mp) goto loop; - simple_lock(&vp->v_interlock); + mtx_enter(&vp->v_interlock, MTX_DEF); nvp = vp->v_mntvnodes.le_next; ip = VTOI(vp); if (vp->v_type == VNON || ((ip->i_flag & (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0 && TAILQ_EMPTY(&vp->v_dirtyblkhd))) { - simple_unlock(&vp->v_interlock); + mtx_exit(&vp->v_interlock, MTX_DEF); continue; } if (vp->v_type != VCHR) { @@ -957,7 +959,7 @@ loop: simple_lock(&mntvnode_slock); } else { simple_unlock(&mntvnode_slock); - simple_unlock(&vp->v_interlock); + mtx_exit(&vp->v_interlock, MTX_DEF); UFS_UPDATE(vp, wait); simple_lock(&mntvnode_slock); } diff --git a/sys/ufs/ufs/ufs_extattr.c b/sys/ufs/ufs/ufs_extattr.c index 593dde1..da9ede2 100644 --- a/sys/ufs/ufs/ufs_extattr.c +++ b/sys/ufs/ufs/ufs_extattr.c @@ -855,4 +855,5 @@ ufs_extattr_vnode_inactive(struct vnode *vp, struct proc *p) ufs_extattr_rm(vp, uele->uele_attrname, 0, p); ufs_extattr_uepm_unlock(ump, p); + lockdestroy(&ump->um_extattr.uepm_lock); } diff --git a/sys/ufs/ufs/ufs_ihash.c b/sys/ufs/ufs/ufs_ihash.c index 36176f0..9153d7a 100644 --- a/sys/ufs/ufs/ufs_ihash.c +++ b/sys/ufs/ufs/ufs_ihash.c @@ -42,6 +42,8 @@ #include <sys/malloc.h> #include <sys/proc.h> +#include <machine/mutex.h> + #include <ufs/ufs/quota.h> #include <ufs/ufs/inode.h> #include <ufs/ufs/ufs_extern.h> @@ -108,7 +110,7 @@ loop: for (ip = INOHASH(dev, inum)->lh_first; ip; ip = ip->i_hash.le_next) { if (inum == ip->i_number && dev == ip->i_dev) { vp = ITOV(ip); - simple_lock(&vp->v_interlock); + mtx_enter(&vp->v_interlock, MTX_DEF); simple_unlock(&ufs_ihash_slock); if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, p)) goto loop; @@ -130,7 +132,7 @@ ufs_ihashins(ip) struct ihashhead *ipp; /* lock the inode, then put it on the appropriate hash list */ - lockmgr(&ip->i_vnode->v_lock, LK_EXCLUSIVE, (struct simplelock *)0, p); + lockmgr(&ip->i_vnode->v_lock, LK_EXCLUSIVE, (struct mtx *)0, p); simple_lock(&ufs_ihash_slock); ipp = INOHASH(ip->i_dev, ip->i_number); diff --git a/sys/ufs/ufs/ufs_inode.c b/sys/ufs/ufs/ufs_inode.c index b700fd3..95b7b84 100644 --- a/sys/ufs/ufs/ufs_inode.c +++ b/sys/ufs/ufs/ufs_inode.c @@ -155,6 +155,7 @@ ufs_reclaim(ap) } } #endif + lockdestroy(&vp->v_lock); FREE(vp->v_data, VFSTOUFS(vp->v_mount)->um_malloctype); vp->v_data = 0; return (0); diff --git a/sys/ufs/ufs/ufs_quota.c b/sys/ufs/ufs/ufs_quota.c index 75a559e..10f93af 100644 --- a/sys/ufs/ufs/ufs_quota.c +++ b/sys/ufs/ufs/ufs_quota.c @@ -674,7 +674,7 @@ again: nextvp = vp->v_mntvnodes.le_next; if (vp->v_type == VNON) continue; - simple_lock(&vp->v_interlock); + mtx_enter(&vp->v_interlock, MTX_DEF); simple_unlock(&mntvnode_slock); error = vget(vp, LK_EXCLUSIVE | LK_NOWAIT | LK_INTERLOCK, p); if (error) { diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index fe8de37..3ac1038 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -60,6 +60,8 @@ #include <sys/event.h> #include <sys/conf.h> +#include <machine/mutex.h> + #include <vm/vm.h> #include <vm/vm_extern.h> @@ -282,10 +284,10 @@ ufs_close(ap) { register struct vnode *vp = ap->a_vp; - simple_lock(&vp->v_interlock); + mtx_enter(&vp->v_interlock, MTX_DEF); if (vp->v_usecount > 1) ufs_itimes(vp); - simple_unlock(&vp->v_interlock); + mtx_exit(&vp->v_interlock, MTX_DEF); return (0); } @@ -1857,10 +1859,10 @@ ufsspec_close(ap) { struct vnode *vp = ap->a_vp; - simple_lock(&vp->v_interlock); + mtx_enter(&vp->v_interlock, MTX_DEF); if (vp->v_usecount > 1) ufs_itimes(vp); - simple_unlock(&vp->v_interlock); + mtx_exit(&vp->v_interlock, MTX_DEF); return (VOCALL(spec_vnodeop_p, VOFFSET(vop_close), ap)); } @@ -1931,10 +1933,10 @@ ufsfifo_close(ap) { struct vnode *vp = ap->a_vp; - simple_lock(&vp->v_interlock); + mtx_enter(&vp->v_interlock, MTX_DEF); if (vp->v_usecount > 1) ufs_itimes(vp); - simple_unlock(&vp->v_interlock); + mtx_exit(&vp->v_interlock, MTX_DEF); return (VOCALL(fifo_vnodeop_p, VOFFSET(vop_close), ap)); } |