Source-Changes-HG archive

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

[src/rmind-uvmplock]: src/sys/fs Finish v_interlock sharing bits for union/un...



details:   https://anonhg.NetBSD.org/src/rev/21c7a331e298
branches:  rmind-uvmplock
changeset: 753086:21c7a331e298
user:      rmind <rmind%NetBSD.org@localhost>
date:      Sat May 21 03:38:24 2011 +0000

description:
Finish v_interlock sharing bits for union/unionfs.

diffstat:

 sys/fs/union/union_subr.c     |  11 ++++++++---
 sys/fs/unionfs/unionfs_subr.c |  12 +++++++-----
 2 files changed, 15 insertions(+), 8 deletions(-)

diffs (62 lines):

diff -r f609d6452207 -r 21c7a331e298 sys/fs/union/union_subr.c
--- a/sys/fs/union/union_subr.c Sat May 21 03:35:21 2011 +0000
+++ b/sys/fs/union/union_subr.c Sat May 21 03:38:24 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: union_subr.c,v 1.35.4.3 2011/05/19 03:43:02 rmind Exp $        */
+/*     $NetBSD: union_subr.c,v 1.35.4.4 2011/05/21 03:38:24 rmind Exp $        */
 
 /*
  * Copyright (c) 1994
@@ -72,7 +72,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: union_subr.c,v 1.35.4.3 2011/05/19 03:43:02 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_subr.c,v 1.35.4.4 2011/05/21 03:38:24 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -507,7 +507,12 @@
                        lowersz = va.va_size;
        hash = UNION_HASH(uppervp, lowervp);
 
-       error = getnewvnode(VT_UNION, mp, union_vnodeop_p, NULL, vpp); /* TODO */
+       /*
+        * Get a new vnode and share the lock with upper layer vnode,
+        * unless layers are inverted.
+        */
+       error = getnewvnode(VT_UNION, mp, union_vnodeop_p,
+           (uppervp != NULLVP ? uppervp : lowervp), vpp);
        if (error) {
                if (uppervp) {
                        if (dvp == uppervp)
diff -r f609d6452207 -r 21c7a331e298 sys/fs/unionfs/unionfs_subr.c
--- a/sys/fs/unionfs/unionfs_subr.c     Sat May 21 03:35:21 2011 +0000
+++ b/sys/fs/unionfs/unionfs_subr.c     Sat May 21 03:38:24 2011 +0000
@@ -91,12 +91,13 @@
                        return (EINVAL);
        }
 
-       unp = kmem_zalloc(sizeof(*unp), KM_SLEEP);
-       if (unp == NULL)
-               return (ENOMEM);
-       error = getnewvnode(VT_UNION, mp, unionfs_vnodeop_p, NULL, &vp); /* TODO */
+       /*
+        * Get a new vnode and share the lock with upper layer vnode,
+        * unless layers are inverted.
+        */
+       error = getnewvnode(VT_UNION, mp, unionfs_vnodeop_p,
+           (uppervp != NULLVP ? uppervp : lowervp), &vp);
        if (error != 0) {
-               kmem_free(unp, sizeof(*unp));
                return (error);
        }
        if (dvp != NULLVP)
@@ -106,6 +107,7 @@
        if (lowervp != NULLVP)
                vref(lowervp);
 
+       unp = kmem_zalloc(sizeof(*unp), KM_SLEEP);
        unp->un_vnode = vp;
        unp->un_uppervp = uppervp;
        unp->un_lowervp = lowervp;



Home | Main Index | Thread Index | Old Index