Source-Changes-HG archive

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

[src/trunk]: src/sys/miscfs add VOP_GETPAGES and VOP_PUTPAGES methods for lay...



details:   https://anonhg.NetBSD.org/src/rev/a931a169d1da
branches:  trunk
changeset: 518824:a931a169d1da
user:      chs <chs%NetBSD.org@localhost>
date:      Thu Dec 06 04:29:23 2001 +0000

description:
add VOP_GETPAGES and VOP_PUTPAGES methods for layered filesystems.
drop the interlock on the upper layer, acquire the interlock on the
lower layer.

diffstat:

 sys/miscfs/genfs/layer_extern.h    |   4 +-
 sys/miscfs/genfs/layer_vnops.c     |  61 ++++++++++++++++++++++++++++++++++++-
 sys/miscfs/nullfs/null_vnops.c     |   9 +++--
 sys/miscfs/overlay/overlay_vnops.c |   9 +++--
 sys/miscfs/umapfs/umap_vnops.c     |   8 ++--
 sys/miscfs/union/union_vnops.c     |  41 +++++++++++++++++++++---
 6 files changed, 110 insertions(+), 22 deletions(-)

diffs (292 lines):

diff -r f4677b006ff2 -r a931a169d1da sys/miscfs/genfs/layer_extern.h
--- a/sys/miscfs/genfs/layer_extern.h   Thu Dec 06 04:28:07 2001 +0000
+++ b/sys/miscfs/genfs/layer_extern.h   Thu Dec 06 04:29:23 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: layer_extern.h,v 1.4 2001/06/07 13:32:47 wiz Exp $     */
+/*     $NetBSD: layer_extern.h,v 1.5 2001/12/06 04:29:23 chs Exp $     */
 
 /*
  * Copyright (c) 1999 National Aeronautics & Space Administration
@@ -117,3 +117,5 @@
 int    layer_setattr __P((void *));
 int    layer_access __P((void *));
 int    layer_open __P((void *));
+int    layer_getpages __P((void *));
+int    layer_putpages __P((void *));
diff -r f4677b006ff2 -r a931a169d1da sys/miscfs/genfs/layer_vnops.c
--- a/sys/miscfs/genfs/layer_vnops.c    Thu Dec 06 04:28:07 2001 +0000
+++ b/sys/miscfs/genfs/layer_vnops.c    Thu Dec 06 04:29:23 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: layer_vnops.c,v 1.9 2001/11/15 09:48:21 lukem Exp $    */
+/*     $NetBSD: layer_vnops.c,v 1.10 2001/12/06 04:29:23 chs Exp $     */
 
 /*
  * Copyright (c) 1999 National Aeronautics & Space Administration
@@ -71,7 +71,7 @@
  *
  * Ancestors:
  *     @(#)lofs_vnops.c        1.2 (Berkeley) 6/18/92
- *     $Id: layer_vnops.c,v 1.9 2001/11/15 09:48:21 lukem Exp $
+ *     $Id: layer_vnops.c,v 1.10 2001/12/06 04:29:23 chs Exp $
  *     ...and...
  *     @(#)null_vnodeops.c 1.20 92/07/07 UCLA Ficus project
  */
@@ -236,7 +236,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: layer_vnops.c,v 1.9 2001/11/15 09:48:21 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: layer_vnops.c,v 1.10 2001/12/06 04:29:23 chs Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -886,3 +886,58 @@
 
        return (error);
 }
+
+int
+layer_getpages(v)
+       void *v;
+{
+       struct vop_getpages_args /* {
+               struct vnode *a_vp;
+               voff_t a_offset;
+               struct vm_page **a_m;
+               int *a_count;
+               int a_centeridx;
+               vm_prot_t a_access_type;
+               int a_advice;
+               int a_flags;
+       } */ *ap = v;
+       struct vnode *vp = ap->a_vp;
+       int error;
+
+       /*
+        * just pass the request on to the underlying layer.
+        */
+
+       if (ap->a_flags & PGO_LOCKED) {
+               return EBUSY;
+       }
+       ap->a_vp = LAYERVPTOLOWERVP(vp);
+       simple_unlock(&vp->v_interlock);
+       simple_lock(&ap->a_vp->v_interlock);
+       error = VCALL(ap->a_vp, VOFFSET(vop_getpages), ap);
+       return error;
+}
+
+int
+layer_putpages(v)
+       void *v;
+{
+       struct vop_putpages_args /* {
+               struct vnode *a_vp;
+               voff_t a_offlo;
+               voff_t a_offhi;
+               int a_flags;
+       } */ *ap = v;
+       struct vnode *vp = ap->a_vp;
+       int error;
+
+       /*
+        * just pass the request on to the underlying layer.
+        */
+
+       ap->a_vp = LAYERVPTOLOWERVP(vp);
+       simple_unlock(&vp->v_interlock);
+       simple_lock(&ap->a_vp->v_interlock);
+       error = VCALL(ap->a_vp, VOFFSET(vop_putpages), ap);
+       return error;
+}
diff -r f4677b006ff2 -r a931a169d1da sys/miscfs/nullfs/null_vnops.c
--- a/sys/miscfs/nullfs/null_vnops.c    Thu Dec 06 04:28:07 2001 +0000
+++ b/sys/miscfs/nullfs/null_vnops.c    Thu Dec 06 04:29:23 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: null_vnops.c,v 1.23 2001/11/15 09:48:22 lukem Exp $    */
+/*     $NetBSD: null_vnops.c,v 1.24 2001/12/06 04:29:23 chs Exp $      */
 
 /*
  * Copyright (c) 1999 National Aeronautics & Space Administration
@@ -71,7 +71,7 @@
  *
  * Ancestors:
  *     @(#)lofs_vnops.c        1.2 (Berkeley) 6/18/92
- *     $Id: null_vnops.c,v 1.23 2001/11/15 09:48:22 lukem Exp $
+ *     $Id: null_vnops.c,v 1.24 2001/12/06 04:29:23 chs Exp $
  *     ...and...
  *     @(#)null_vnodeops.c 1.20 92/07/07 UCLA Ficus project
  */
@@ -207,7 +207,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: null_vnops.c,v 1.23 2001/11/15 09:48:22 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: null_vnops.c,v 1.24 2001/12/06 04:29:23 chs Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -246,8 +246,9 @@
        { &vop_strategy_desc, layer_strategy },
        { &vop_bwrite_desc,   layer_bwrite },
        { &vop_bmap_desc,     layer_bmap },
+       { &vop_putpages_desc, layer_putpages },
 
-       { (struct vnodeop_desc*)NULL, (int(*)__P((void *)))NULL }
+       { NULL, NULL }
 };
 const struct vnodeopv_desc null_vnodeop_opv_desc =
        { &null_vnodeop_p, null_vnodeop_entries };
diff -r f4677b006ff2 -r a931a169d1da sys/miscfs/overlay/overlay_vnops.c
--- a/sys/miscfs/overlay/overlay_vnops.c        Thu Dec 06 04:28:07 2001 +0000
+++ b/sys/miscfs/overlay/overlay_vnops.c        Thu Dec 06 04:29:23 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: overlay_vnops.c,v 1.7 2001/11/15 09:48:22 lukem Exp $  */
+/*     $NetBSD: overlay_vnops.c,v 1.8 2001/12/06 04:29:23 chs Exp $    */
 
 /*
  * Copyright (c) 1999, 2000 National Aeronautics & Space Administration
@@ -71,7 +71,7 @@
  *
  * Ancestors:
  *     @(#)lofs_vnops.c        1.2 (Berkeley) 6/18/92
- *     $Id: overlay_vnops.c,v 1.7 2001/11/15 09:48:22 lukem Exp $
+ *     $Id: overlay_vnops.c,v 1.8 2001/12/06 04:29:23 chs Exp $
  *     ...and...
  *     @(#)null_vnodeops.c 1.20 92/07/07 UCLA Ficus project
  */
@@ -130,7 +130,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: overlay_vnops.c,v 1.7 2001/11/15 09:48:22 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: overlay_vnops.c,v 1.8 2001/12/06 04:29:23 chs Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -169,8 +169,9 @@
        { &vop_strategy_desc, layer_strategy },
        { &vop_bwrite_desc,   layer_bwrite },
        { &vop_bmap_desc,     layer_bmap },
+       { &vop_putpages_desc, layer_putpages },
 
-       { (struct vnodeop_desc*)NULL, (int(*)__P((void *)))NULL }
+       { NULL, NULL }
 };
 const struct vnodeopv_desc overlay_vnodeop_opv_desc =
        { &overlay_vnodeop_p, overlay_vnodeop_entries };
diff -r f4677b006ff2 -r a931a169d1da sys/miscfs/umapfs/umap_vnops.c
--- a/sys/miscfs/umapfs/umap_vnops.c    Thu Dec 06 04:28:07 2001 +0000
+++ b/sys/miscfs/umapfs/umap_vnops.c    Thu Dec 06 04:29:23 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: umap_vnops.c,v 1.20 2001/11/15 09:48:23 lukem Exp $    */
+/*     $NetBSD: umap_vnops.c,v 1.21 2001/12/06 04:29:23 chs Exp $      */
 
 /*
  * Copyright (c) 1992, 1993
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umap_vnops.c,v 1.20 2001/11/15 09:48:23 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umap_vnops.c,v 1.21 2001/12/06 04:29:23 chs Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -57,7 +57,6 @@
 #include <miscfs/genfs/genfs.h>
 #include <miscfs/genfs/layer_extern.h>
 
-
 int    umap_lookup     __P((void *));
 int    umap_getattr    __P((void *));
 int    umap_print      __P((void *));
@@ -93,8 +92,9 @@
        { &vop_strategy_desc,   layer_strategy },
        { &vop_bwrite_desc,     layer_bwrite },
        { &vop_bmap_desc,       layer_bmap },
+       { &vop_putpages_desc,   layer_putpages },
 
-       { (struct vnodeop_desc*) NULL, (int(*) __P((void *))) NULL }
+       { NULL, NULL }
 };
 const struct vnodeopv_desc umapfs_vnodeop_opv_desc =
        { &umap_vnodeop_p, umap_vnodeop_entries };
diff -r f4677b006ff2 -r a931a169d1da sys/miscfs/union/union_vnops.c
--- a/sys/miscfs/union/union_vnops.c    Thu Dec 06 04:28:07 2001 +0000
+++ b/sys/miscfs/union/union_vnops.c    Thu Dec 06 04:29:23 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: union_vnops.c,v 1.57 2001/11/15 09:48:25 lukem Exp $   */
+/*     $NetBSD: union_vnops.c,v 1.58 2001/12/06 04:29:24 chs Exp $     */
 
 /*
  * Copyright (c) 1992, 1993, 1994, 1995 Jan-Simon Pendry.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.57 2001/11/15 09:48:25 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.58 2001/12/06 04:29:24 chs Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -96,6 +96,7 @@
 int union_advlock      __P((void *));
 int union_strategy     __P((void *));
 int union_getpages     __P((void *));
+int union_putpages     __P((void *));
 
 static void union_fixup __P((struct union_node *));
 static int union_lookup1 __P((struct vnode *, struct vnode **,
@@ -146,6 +147,7 @@
        { &vop_pathconf_desc, union_pathconf },         /* pathconf */
        { &vop_advlock_desc, union_advlock },           /* advlock */
        { &vop_getpages_desc, union_getpages },         /* getpages */
+       { &vop_putpages_desc, union_putpages },         /* putpages */
 #ifdef notdef
        { &vop_blkatoff_desc, union_blkatoff },         /* blkatoff */
        { &vop_valloc_desc, union_valloc },             /* valloc */
@@ -1991,12 +1993,39 @@
        int error;
 
        /*
-        * just call into the underlying layer to get the pages.
+        * just pass the request on to the underlying layer.
+        */
+
+       if (ap->a_flags & PGO_LOCKED) {
+               return EBUSY;
+       }
+       ap->a_vp = OTHERVP(vp);
+       simple_unlock(&vp->v_interlock);
+       simple_lock(&ap->a_vp->v_interlock);
+       error = VCALL(ap->a_vp, VOFFSET(vop_getpages), ap);
+       return error;
+}
+
+int
+union_putpages(v)
+       void *v;
+{
+       struct vop_putpages_args /* {
+               struct vnode *a_vp;
+               voff_t a_offlo;
+               voff_t a_offhi;
+               int a_flags;
+       } */ *ap = v;
+       struct vnode *vp = ap->a_vp;
+       int error;
+
+       /*
+        * just pass the request on to the underlying layer.
         */
 
        ap->a_vp = OTHERVP(vp);
-       simple_unlock(&vp->v_uobj.vmobjlock);
-       simple_lock(&ap->a_vp->v_uobj.vmobjlock);
-       error = VCALL(ap->a_vp, VOFFSET(vop_getpages), ap);
+       simple_unlock(&vp->v_interlock);
+       simple_lock(&ap->a_vp->v_interlock);
+       error = VCALL(ap->a_vp, VOFFSET(vop_putpages), ap);
        return error;
 }



Home | Main Index | Thread Index | Old Index