Source-Changes-HG archive

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

[src/rmind-uvmplock]: src/sys/fs/tmpfs tmpfs_alloc_vp: perform lock sharing o...



details:   https://anonhg.NetBSD.org/src/rev/f1fd705a610d
branches:  rmind-uvmplock
changeset: 753093:f1fd705a610d
user:      rmind <rmind%NetBSD.org@localhost>
date:      Tue May 31 01:51:58 2011 +0000

description:
tmpfs_alloc_vp: perform lock sharing only for VREG.

diffstat:

 sys/fs/tmpfs/tmpfs_subr.c |  19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diffs (52 lines):

diff -r 0d7e7914556a -r f1fd705a610d sys/fs/tmpfs/tmpfs_subr.c
--- a/sys/fs/tmpfs/tmpfs_subr.c Mon May 30 17:16:47 2011 +0000
+++ b/sys/fs/tmpfs/tmpfs_subr.c Tue May 31 01:51:58 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tmpfs_subr.c,v 1.56.4.7 2011/05/30 14:57:48 rmind Exp $        */
+/*     $NetBSD: tmpfs_subr.c,v 1.56.4.8 2011/05/31 01:51:58 rmind Exp $        */
 
 /*
  * Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.56.4.7 2011/05/30 14:57:48 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.56.4.8 2011/05/31 01:51:58 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/dirent.h>
@@ -344,7 +344,7 @@
 int
 tmpfs_alloc_vp(struct mount *mp, struct tmpfs_node *node, struct vnode **vpp)
 {
-       struct uvm_object *uobj;
+       kmutex_t *slock;
        int error;
        struct vnode *vp;
 
@@ -367,16 +367,19 @@
 
        /*
         * Get a new vnode and associate it with our inode.  Share the
-        * lock with underlying UVM object.
+        * lock with underlying UVM object, if there is one (VREG case).
         */
-       uobj = node->tn_spec.tn_reg.tn_aobj;
-       error = getnewvnode(VT_TMPFS, mp, tmpfs_vnodeop_p,
-           uobj->vmobjlock, &vp);
+       if (node->tn_type == VREG) {
+               struct uvm_object *uobj = node->tn_spec.tn_reg.tn_aobj;
+               slock = uobj->vmobjlock;
+       } else {
+               slock = NULL;
+       }
+       error = getnewvnode(VT_TMPFS, mp, tmpfs_vnodeop_p, slock, &vp);
        if (error != 0) {
                mutex_exit(&node->tn_vlock);
                return error;
        }
-       KASSERT(uobj->vmobjlock == vp->v_interlock);
 
        error = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
        if (error != 0) {



Home | Main Index | Thread Index | Old Index