From 25230d4c6a8ce0a2007e1b2694fcc4ff0869e15c Mon Sep 17 00:00:00 2001 From: mckusick Date: Mon, 14 Oct 2002 03:20:36 +0000 Subject: Regularize the vop_stdlock'ing protocol across all the filesystems that use it. Specifically, vop_stdlock uses the lock pointed to by vp->v_vnlock. By default, getnewvnode sets up vp->v_vnlock to reference vp->v_lock. Filesystems that wish to use the default do not need to allocate a lock at the front of their node structure (as some still did) or do a lockinit. They can simply start using vn_lock/VOP_UNLOCK. Filesystems that wish to manage their own locks, but still use the vop_stdlock functions (such as nullfs) can simply replace vp->v_vnlock with a pointer to the lock that they wish to have used for the vnode. Such filesystems are responsible for setting the vp->v_vnlock back to the default in their vop_reclaim routine (e.g., vp->v_vnlock = &vp->v_lock). In theory, this set of changes cleans up the existing filesystem lock interface and should have no function change to the existing locking scheme. Sponsored by: DARPA & NAI Labs. --- sys/fs/cd9660/cd9660_node.c | 3 +-- sys/fs/cd9660/cd9660_vfsops.c | 5 ----- 2 files changed, 1 insertion(+), 7 deletions(-) (limited to 'sys/fs/cd9660') diff --git a/sys/fs/cd9660/cd9660_node.c b/sys/fs/cd9660/cd9660_node.c index 44e60fa..e120bc4 100644 --- a/sys/fs/cd9660/cd9660_node.c +++ b/sys/fs/cd9660/cd9660_node.c @@ -143,7 +143,7 @@ cd9660_ihashins(ip) *ipp = ip; mtx_unlock(&cd9660_ihash_mtx); - lockmgr(&ip->i_vnode->v_lock, LK_EXCLUSIVE, (struct mtx *)0, curthread); + vn_lock(ITOV(ip), LK_EXCLUSIVE | LK_RETRY, curthread); } /* @@ -223,7 +223,6 @@ cd9660_reclaim(ap) vrele(ip->i_devvp); ip->i_devvp = 0; } - lockdestroy(&ip->i_vnode->v_lock); FREE(vp->v_data, M_ISOFSNODE); vp->v_data = NULL; return (0); diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c index 74608a6..c25d4bb 100644 --- a/sys/fs/cd9660/cd9660_vfsops.c +++ b/sys/fs/cd9660/cd9660_vfsops.c @@ -714,11 +714,6 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir) } MALLOC(ip, struct iso_node *, sizeof(struct iso_node), M_ISOFSNODE, M_WAITOK | M_ZERO); - lockinit(&vp->v_lock, PINOD, "isonode", 0, 0); - /* - * ISOFS uses stdlock and can share lock structure - */ - vp->v_vnlock = &vp->v_lock; vp->v_data = ip; ip->i_vnode = vp; ip->i_dev = dev; -- cgit v1.1