Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Remove vlockmgr(). Generic vnode lock operations now us...



details:   https://anonhg.NetBSD.org/src/rev/e950910854b0
branches:  trunk
changeset: 755978:e950910854b0
user:      hannken <hannken%NetBSD.org@localhost>
date:      Thu Jul 01 13:00:54 2010 +0000

description:
Remove vlockmgr().  Generic vnode lock operations now use a rwlock located
in the vnode.  All LK_* flags move from sys/lock.h to sys/vnode.h.  Calls
to vlockmgr() in file systems get replaced with VOP_LOCK() or VOP_UNLOCK().

Welcome to 5.99.34.

Discussed on tech-kern.

diffstat:

 sys/coda/coda_vnops.c             |  12 +++----
 sys/fs/adosfs/adutil.c            |   6 +-
 sys/fs/cd9660/cd9660_node.c       |   6 +-
 sys/fs/efs/efs_ihash.c            |   6 +-
 sys/fs/filecorefs/filecore_node.c |   8 +---
 sys/fs/hfs/hfs_nhash.c            |   6 +-
 sys/fs/ntfs/ntfs_vfsops.c         |   6 +-
 sys/fs/ptyfs/ptyfs_subr.c         |   6 +-
 sys/fs/udf/udf_subr.c             |  10 +++---
 sys/fs/union/union_vnops.c        |   8 ++--
 sys/kern/vfs_subr.c               |  60 +++-----------------------------------
 sys/miscfs/genfs/genfs_vnops.c    |  28 ++++++++++++++---
 sys/miscfs/kernfs/kernfs_subr.c   |   6 +-
 sys/miscfs/procfs/procfs_subr.c   |   6 +-
 sys/netsmb/smb_conn.c             |   8 ++--
 sys/nfs/nfs_node.c                |   6 +-
 sys/sys/lock.h                    |  12 +-------
 sys/sys/param.h                   |   4 +-
 sys/sys/vnode.h                   |  29 ++++++++----------
 sys/ufs/lfs/lfs_syscalls.c        |   8 ++--
 sys/ufs/ufs/ufs_ihash.c           |   6 +-
 21 files changed, 100 insertions(+), 147 deletions(-)

diffs (truncated from 811 to 300 lines):

diff -r a49c9366a9f8 -r e950910854b0 sys/coda/coda_vnops.c
--- a/sys/coda/coda_vnops.c     Thu Jul 01 09:28:37 2010 +0000
+++ b/sys/coda/coda_vnops.c     Thu Jul 01 13:00:54 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: coda_vnops.c,v 1.74 2010/06/24 13:03:06 hannken Exp $  */
+/*     $NetBSD: coda_vnops.c,v 1.75 2010/07/01 13:00:54 hannken Exp $  */
 
 /*
  *
@@ -46,7 +46,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.74 2010/06/24 13:03:06 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.75 2010/07/01 13:00:54 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1775,7 +1775,6 @@
     struct vop_lock_args *ap = v;
     struct vnode *vp = ap->a_vp;
     struct cnode *cp = VTOC(vp);
-    int flags  = ap->a_flags;
 /* upcall decl */
 /* locals */
 
@@ -1786,7 +1785,7 @@
                  coda_f2s(&cp->c_fid)));
     }
 
-    return (vlockmgr(&vp->v_lock, flags));
+    return genfs_lock(v);
 }
 
 int
@@ -1805,17 +1804,16 @@
                  coda_f2s(&cp->c_fid)));
     }
 
-    return (vlockmgr(&vp->v_lock, LK_RELEASE));
+    return genfs_unlock(v);
 }
 
 int
 coda_islocked(void *v)
 {
 /* true args */
-    struct vop_islocked_args *ap = v;
     ENTRY;
 
-    return (vlockstatus(&ap->a_vp->v_lock));
+    return genfs_islocked(v);
 }
 
 /*
diff -r a49c9366a9f8 -r e950910854b0 sys/fs/adosfs/adutil.c
--- a/sys/fs/adosfs/adutil.c    Thu Jul 01 09:28:37 2010 +0000
+++ b/sys/fs/adosfs/adutil.c    Thu Jul 01 13:00:54 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: adutil.c,v 1.11 2009/03/14 21:04:23 dsl Exp $  */
+/*     $NetBSD: adutil.c,v 1.12 2010/07/01 13:00:55 hannken Exp $      */
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: adutil.c,v 1.11 2009/03/14 21:04:23 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adutil.c,v 1.12 2010/07/01 13:00:55 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/vnode.h>
@@ -87,7 +87,7 @@
 void
 adosfs_ainshash(struct adosfsmount *amp, struct anode *ap)
 {
-       vlockmgr(&ap->vp->v_lock, LK_EXCLUSIVE);
+       VOP_LOCK(ATOV(ap), LK_EXCLUSIVE);
 
        simple_lock(&adosfs_hashlock);
        LIST_INSERT_HEAD(&amp->anodetab[AHASH(ap->block)], ap, link);
diff -r a49c9366a9f8 -r e950910854b0 sys/fs/cd9660/cd9660_node.c
--- a/sys/fs/cd9660/cd9660_node.c       Thu Jul 01 09:28:37 2010 +0000
+++ b/sys/fs/cd9660/cd9660_node.c       Thu Jul 01 13:00:54 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cd9660_node.c,v 1.25 2010/06/24 13:03:09 hannken Exp $ */
+/*     $NetBSD: cd9660_node.c,v 1.26 2010/07/01 13:00:55 hannken Exp $ */
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1994
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cd9660_node.c,v 1.25 2010/06/24 13:03:09 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd9660_node.c,v 1.26 2010/07/01 13:00:55 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -178,7 +178,7 @@
        LIST_INSERT_HEAD(ipp, ip, i_hash);
        mutex_exit(&cd9660_ihash_lock);
 
-       vlockmgr(&ip->i_vnode->v_lock, LK_EXCLUSIVE);
+       VOP_LOCK(ITOV(ip), LK_EXCLUSIVE);
 }
 
 /*
diff -r a49c9366a9f8 -r e950910854b0 sys/fs/efs/efs_ihash.c
--- a/sys/fs/efs/efs_ihash.c    Thu Jul 01 09:28:37 2010 +0000
+++ b/sys/fs/efs/efs_ihash.c    Thu Jul 01 13:00:54 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: efs_ihash.c,v 1.4 2008/05/05 17:11:16 ad Exp $ */
+/*     $NetBSD: efs_ihash.c,v 1.5 2010/07/01 13:00:55 hannken Exp $    */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: efs_ihash.c,v 1.4 2008/05/05 17:11:16 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: efs_ihash.c,v 1.5 2010/07/01 13:00:55 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -167,7 +167,7 @@
        KASSERT(mutex_owned(&efs_hashlock));
 
        /* lock the inode, then put it on the appropriate hash list */
-       vlockmgr(&eip->ei_vp->v_lock, LK_EXCLUSIVE);
+       VOP_LOCK(EFS_ITOV(eip), LK_EXCLUSIVE);
 
        mutex_enter(&efs_ihash_lock);
        ipp = &ihashtbl[INOHASH(eip->ei_dev, eip->ei_number)];
diff -r a49c9366a9f8 -r e950910854b0 sys/fs/filecorefs/filecore_node.c
--- a/sys/fs/filecorefs/filecore_node.c Thu Jul 01 09:28:37 2010 +0000
+++ b/sys/fs/filecorefs/filecore_node.c Thu Jul 01 13:00:54 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: filecore_node.c,v 1.20 2010/06/24 13:03:09 hannken Exp $       */
+/*     $NetBSD: filecore_node.c,v 1.21 2010/07/01 13:00:55 hannken Exp $       */
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1994
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: filecore_node.c,v 1.20 2010/06/24 13:03:09 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: filecore_node.c,v 1.21 2010/07/01 13:00:55 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -190,15 +190,13 @@
 filecore_ihashins(struct filecore_node *ip)
 {
        struct ihashhead *ipp;
-       struct vnode *vp;
 
        simple_lock(&filecore_ihash_slock);
        ipp = &filecorehashtbl[INOHASH(ip->i_dev, ip->i_number)];
        LIST_INSERT_HEAD(ipp, ip, i_hash);
        simple_unlock(&filecore_ihash_slock);
 
-       vp = ip->i_vnode;
-       vlockmgr(&vp->v_lock, LK_EXCLUSIVE);
+       VOP_LOCK(ITOV(ip), LK_EXCLUSIVE);
 }
 
 /*
diff -r a49c9366a9f8 -r e950910854b0 sys/fs/hfs/hfs_nhash.c
--- a/sys/fs/hfs/hfs_nhash.c    Thu Jul 01 09:28:37 2010 +0000
+++ b/sys/fs/hfs/hfs_nhash.c    Thu Jul 01 13:00:54 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hfs_nhash.c,v 1.9 2008/09/03 22:57:46 gmcgarry Exp $   */
+/*     $NetBSD: hfs_nhash.c,v 1.10 2010/07/01 13:00:55 hannken Exp $   */
 
 /*-
  * Copyright (c) 2005, 2007 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hfs_nhash.c,v 1.9 2008/09/03 22:57:46 gmcgarry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hfs_nhash.c,v 1.10 2010/07/01 13:00:55 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -150,7 +150,7 @@
        struct nhashhead *hpp;
 
        /* lock the inode, then put it on the appropriate hash list */
-       vlockmgr(&hp->h_vnode->v_lock, LK_EXCLUSIVE);
+       VOP_LOCK(HTOV(hp), LK_EXCLUSIVE);
 
        mutex_enter(&hfs_nhash_lock);
        hpp = &nhashtbl[HNOHASH(hp->h_dev, hp->h_rec.u.cnid, hp->h_fork)];
diff -r a49c9366a9f8 -r e950910854b0 sys/fs/ntfs/ntfs_vfsops.c
--- a/sys/fs/ntfs/ntfs_vfsops.c Thu Jul 01 09:28:37 2010 +0000
+++ b/sys/fs/ntfs/ntfs_vfsops.c Thu Jul 01 13:00:54 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ntfs_vfsops.c,v 1.81 2010/06/24 13:03:10 hannken Exp $ */
+/*     $NetBSD: ntfs_vfsops.c,v 1.82 2010/07/01 13:00:55 hannken Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999 Semen Ustimenko
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.81 2010/06/24 13:03:10 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.82 2010/07/01 13:00:55 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -807,7 +807,7 @@
        if (ino == NTFS_ROOTINO)
                vp->v_vflag |= VV_ROOT;
 
-       if (lkflags & LK_TYPE_MASK) {
+       if (lkflags & (LK_EXCLUSIVE | LK_SHARED)) {
                error = vn_lock(vp, lkflags);
                if (error) {
                        vput(vp);
diff -r a49c9366a9f8 -r e950910854b0 sys/fs/ptyfs/ptyfs_subr.c
--- a/sys/fs/ptyfs/ptyfs_subr.c Thu Jul 01 09:28:37 2010 +0000
+++ b/sys/fs/ptyfs/ptyfs_subr.c Thu Jul 01 13:00:54 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ptyfs_subr.c,v 1.19 2010/06/24 13:03:10 hannken Exp $  */
+/*     $NetBSD: ptyfs_subr.c,v 1.20 2010/07/01 13:00:55 hannken Exp $  */
 
 /*
  * Copyright (c) 1993
@@ -73,7 +73,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ptyfs_subr.c,v 1.19 2010/06/24 13:03:10 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ptyfs_subr.c,v 1.20 2010/07/01 13:00:55 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -388,7 +388,7 @@
        struct ptyfs_hashhead *ppp;
 
        /* lock the ptyfsnode, then put it on the appropriate hash list */
-       vlockmgr(&pp->ptyfs_vnode->v_lock, LK_EXCLUSIVE);
+       VOP_LOCK(PTYFSTOV(pp), LK_EXCLUSIVE);
 
        mutex_enter(&ptyfs_used_slock);
        ppp = &ptyfs_used_tbl[PTYHASH(pp->ptyfs_type, pp->ptyfs_pty,
diff -r a49c9366a9f8 -r e950910854b0 sys/fs/udf/udf_subr.c
--- a/sys/fs/udf/udf_subr.c     Thu Jul 01 09:28:37 2010 +0000
+++ b/sys/fs/udf/udf_subr.c     Thu Jul 01 13:00:54 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_subr.c,v 1.105 2010/06/06 08:01:31 hannken Exp $ */
+/* $NetBSD: udf_subr.c,v 1.106 2010/07/01 13:00:55 hannken Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -29,7 +29,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.105 2010/06/06 08:01:31 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.106 2010/07/01 13:00:55 hannken Exp $");
 #endif /* not lint */
 
 
@@ -5452,7 +5452,7 @@
                /* recycle udf_node */
                udf_dispose_node(udf_node);
 
-               vlockmgr(&nvp->v_lock, LK_RELEASE);
+               VOP_UNLOCK(nvp);
                nvp->v_data = NULL;
                ungetnewvnode(nvp);
 
@@ -5548,7 +5548,7 @@
                /* recycle udf_node */
                udf_dispose_node(udf_node);
 
-               vlockmgr(&nvp->v_lock, LK_RELEASE);
+               VOP_UNLOCK(nvp);
                nvp->v_data = NULL;
                ungetnewvnode(nvp);
 
@@ -5883,7 +5883,7 @@
        udf_do_unreserve_space(ump, NULL, vpart_num, 1);
 
 error_out_unlock:
-       vlockmgr(&nvp->v_lock, LK_RELEASE);
+       VOP_UNLOCK(nvp);
 
 error_out_unget:
        nvp->v_data = NULL;
diff -r a49c9366a9f8 -r e950910854b0 sys/fs/union/union_vnops.c
--- a/sys/fs/union/union_vnops.c        Thu Jul 01 09:28:37 2010 +0000
+++ b/sys/fs/union/union_vnops.c        Thu Jul 01 13:00:54 2010 +0000



Home | Main Index | Thread Index | Old Index