diff options
author | Jeff Roberson <jeff@FreeBSD.org> | 2005-03-13 12:09:34 +0000 |
---|---|---|
committer | Jeff Roberson <jeff@FreeBSD.org> | 2005-03-13 12:09:34 +0000 |
commit | 172ffe319a25a2544daba7c47c1d13127e10bd3f (patch) | |
tree | 8ac96f3941fbc2c7c70c52e324f9e0bc3a9e3baf | |
parent | 3100b7003783dddcf751fdab5a969a81310ceff7 (diff) | |
download | src-172ffe319a25a2544daba7c47c1d13127e10bd3f.tar.gz src-172ffe319a25a2544daba7c47c1d13127e10bd3f.zip |
- The c_lock in the coda node does not offer any features over the standard
vnode lock. Remove the c_lock and use the vn lock in its place.
- Keep the coda lock functions so that the debugging information is
preserved, but call directly to the vop_std*lock routines for the real
functionality.
Sponsored by: Isilon Systems, Inc.
Notes
Notes:
svn path=/head/; revision=143507
-rw-r--r-- | sys/coda/cnode.h | 1 | ||||
-rw-r--r-- | sys/coda/coda_vnops.c | 23 | ||||
-rw-r--r-- | sys/fs/coda/cnode.h | 1 | ||||
-rw-r--r-- | sys/fs/coda/coda_vnops.c | 23 |
4 files changed, 16 insertions, 32 deletions
diff --git a/sys/coda/cnode.h b/sys/coda/cnode.h index 3041478cac66..8bbdeb55b0f9 100644 --- a/sys/coda/cnode.h +++ b/sys/coda/cnode.h @@ -102,7 +102,6 @@ struct cnode { struct vnode *c_vnode; u_short c_flags; /* flags (see below) */ CodaFid c_fid; /* file handle */ - struct lock c_lock; /* new lock protocol */ struct vnode *c_ovp; /* open vnode pointer */ u_short c_ocount; /* count of openers */ u_short c_owrite; /* count of open for write */ diff --git a/sys/coda/coda_vnops.c b/sys/coda/coda_vnops.c index 025c08163c6b..389f78bf0224 100644 --- a/sys/coda/coda_vnops.c +++ b/sys/coda/coda_vnops.c @@ -847,7 +847,6 @@ coda_inactive(struct vop_inactive_args *ap) printf("coda_inactive: cp->ovp != NULL use %d: vp %p, cp %p\n", vrefcnt(vp), vp, cp); #endif - lockmgr(&cp->c_lock, LK_RELEASE, &vp->v_interlock, td); } else { #ifdef OLD_DIAGNOSTIC if (vrefcnt(CTOV(cp))) { @@ -857,7 +856,6 @@ coda_inactive(struct vop_inactive_args *ap) panic("coda_inactive: cp->ovp != NULL"); } #endif - VOP_UNLOCK(vp, 0, td); vgone(vp); } @@ -1630,7 +1628,6 @@ coda_reclaim(struct vop_reclaim_args *ap) #endif } cache_purge(vp); - lockdestroy(&(VTOC(vp)->c_lock)); coda_free(VTOC(vp)); vp->v_data = NULL; vnode_destroy_vobject(vp); @@ -1643,23 +1640,22 @@ coda_lock(struct vop_lock_args *ap) /* true args */ struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); - struct thread *td = ap->a_td; /* upcall decl */ /* locals */ ENTRY; + if ((ap->a_flags & LK_INTERLOCK) == 0) { + VI_LOCK(vp); + ap->a_flags |= LK_INTERLOCK; + } + if (coda_lockdebug) { myprintf(("Attempting lock on %s\n", coda_f2s(&cp->c_fid))); } -#ifndef DEBUG_LOCKS - return (lockmgr(&cp->c_lock, ap->a_flags, &vp->v_interlock, td)); -#else - return (debuglockmgr(&cp->c_lock, ap->a_flags, &vp->v_interlock, td, - "coda_lock", vp->filename, vp->line)); -#endif + return (vop_stdlock(ap)); } int @@ -1668,7 +1664,6 @@ coda_unlock(struct vop_unlock_args *ap) /* true args */ struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); - struct thread *td = ap->a_td; /* upcall decl */ /* locals */ @@ -1678,17 +1673,16 @@ coda_unlock(struct vop_unlock_args *ap) coda_f2s(&cp->c_fid))); } - return (lockmgr(&cp->c_lock, ap->a_flags | LK_RELEASE, &vp->v_interlock, td)); + return (vop_stdunlock(ap)); } int coda_islocked(struct vop_islocked_args *ap) { /* true args */ - struct cnode *cp = VTOC(ap->a_vp); ENTRY; - return (lockstatus(&cp->c_lock, ap->a_td)); + return (vop_stdislocked(ap)); } /* How one looks up a vnode given a device/inode pair: */ @@ -1808,7 +1802,6 @@ make_coda_node(fid, vfsp, type) struct vnode *vp; cp = coda_alloc(); - lockinit(&cp->c_lock, PINOD, "cnode", 0, 0); cp->c_fid = *fid; err = getnewvnode("coda", vfsp, &coda_vnodeops, &vp); diff --git a/sys/fs/coda/cnode.h b/sys/fs/coda/cnode.h index 3041478cac66..8bbdeb55b0f9 100644 --- a/sys/fs/coda/cnode.h +++ b/sys/fs/coda/cnode.h @@ -102,7 +102,6 @@ struct cnode { struct vnode *c_vnode; u_short c_flags; /* flags (see below) */ CodaFid c_fid; /* file handle */ - struct lock c_lock; /* new lock protocol */ struct vnode *c_ovp; /* open vnode pointer */ u_short c_ocount; /* count of openers */ u_short c_owrite; /* count of open for write */ diff --git a/sys/fs/coda/coda_vnops.c b/sys/fs/coda/coda_vnops.c index 025c08163c6b..389f78bf0224 100644 --- a/sys/fs/coda/coda_vnops.c +++ b/sys/fs/coda/coda_vnops.c @@ -847,7 +847,6 @@ coda_inactive(struct vop_inactive_args *ap) printf("coda_inactive: cp->ovp != NULL use %d: vp %p, cp %p\n", vrefcnt(vp), vp, cp); #endif - lockmgr(&cp->c_lock, LK_RELEASE, &vp->v_interlock, td); } else { #ifdef OLD_DIAGNOSTIC if (vrefcnt(CTOV(cp))) { @@ -857,7 +856,6 @@ coda_inactive(struct vop_inactive_args *ap) panic("coda_inactive: cp->ovp != NULL"); } #endif - VOP_UNLOCK(vp, 0, td); vgone(vp); } @@ -1630,7 +1628,6 @@ coda_reclaim(struct vop_reclaim_args *ap) #endif } cache_purge(vp); - lockdestroy(&(VTOC(vp)->c_lock)); coda_free(VTOC(vp)); vp->v_data = NULL; vnode_destroy_vobject(vp); @@ -1643,23 +1640,22 @@ coda_lock(struct vop_lock_args *ap) /* true args */ struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); - struct thread *td = ap->a_td; /* upcall decl */ /* locals */ ENTRY; + if ((ap->a_flags & LK_INTERLOCK) == 0) { + VI_LOCK(vp); + ap->a_flags |= LK_INTERLOCK; + } + if (coda_lockdebug) { myprintf(("Attempting lock on %s\n", coda_f2s(&cp->c_fid))); } -#ifndef DEBUG_LOCKS - return (lockmgr(&cp->c_lock, ap->a_flags, &vp->v_interlock, td)); -#else - return (debuglockmgr(&cp->c_lock, ap->a_flags, &vp->v_interlock, td, - "coda_lock", vp->filename, vp->line)); -#endif + return (vop_stdlock(ap)); } int @@ -1668,7 +1664,6 @@ coda_unlock(struct vop_unlock_args *ap) /* true args */ struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); - struct thread *td = ap->a_td; /* upcall decl */ /* locals */ @@ -1678,17 +1673,16 @@ coda_unlock(struct vop_unlock_args *ap) coda_f2s(&cp->c_fid))); } - return (lockmgr(&cp->c_lock, ap->a_flags | LK_RELEASE, &vp->v_interlock, td)); + return (vop_stdunlock(ap)); } int coda_islocked(struct vop_islocked_args *ap) { /* true args */ - struct cnode *cp = VTOC(ap->a_vp); ENTRY; - return (lockstatus(&cp->c_lock, ap->a_td)); + return (vop_stdislocked(ap)); } /* How one looks up a vnode given a device/inode pair: */ @@ -1808,7 +1802,6 @@ make_coda_node(fid, vfsp, type) struct vnode *vp; cp = coda_alloc(); - lockinit(&cp->c_lock, PINOD, "cnode", 0, 0); cp->c_fid = *fid; err = getnewvnode("coda", vfsp, &coda_vnodeops, &vp); |