Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Change VOP_BWRITE() to take a vnode as its first ar...



details:   https://anonhg.NetBSD.org/src/rev/3410cdb54fb1
branches:  trunk
changeset: 767201:3410cdb54fb1
user:      hannken <hannken%NetBSD.org@localhost>
date:      Mon Jul 11 08:23:00 2011 +0000

description:
Change VOP_BWRITE() to take a vnode as its first argument like all other
VOPs do.  Layered file systems no longer have to modify bp->b_vp and run
into trouble when an async VOP_BWRITE() uses the wrong vnode.

Adresses PR kern/38762 panic: vwakeup: neg numoutput

No objections from tech-kern@.

diffstat:

 sys/kern/vnode_if.sh  |  33 ++++-----------------------------
 sys/kern/vnode_if.src |  18 ++++++++++--------
 2 files changed, 14 insertions(+), 37 deletions(-)

diffs (127 lines):

diff -r 0aed9a932562 -r 3410cdb54fb1 sys/kern/vnode_if.sh
--- a/sys/kern/vnode_if.sh      Mon Jul 11 08:22:49 2011 +0000
+++ b/sys/kern/vnode_if.sh      Mon Jul 11 08:23:00 2011 +0000
@@ -29,7 +29,7 @@
  * SUCH DAMAGE.
  */
 "
-SCRIPT_ID='$NetBSD: vnode_if.sh,v 1.57 2011/04/03 01:19:37 rmind Exp $'
+SCRIPT_ID='$NetBSD: vnode_if.sh,v 1.58 2011/07/11 08:23:00 hannken Exp $'
 
 # Script to produce VFS front-end sugar.
 #
@@ -247,7 +247,6 @@
        printf(");\n");
 }
 BEGIN  {
-       arg0special="";
        vop_offset = 1; # start at 1, to count the 'default' op
 
        printf("struct buf;\n");
@@ -257,16 +256,6 @@
                printf("struct vm_page;\n");
        }
        printf("\n#ifndef _KERNEL\n#include <stdbool.h>\n#endif\n");
-       printf("\n/* Special cases: */\n");
-
-       argc=1;
-       argtype[0]="struct buf *";
-       argname[0]="bp";
-       lockstate[0] = -1;
-       arg0special="->b_vp";
-       name="vop_bwrite";
-       doit();
-       printf("\n/* End of special cases */\n");
        if (rump)
                printf("\n");
 }
@@ -420,10 +409,10 @@
                        printf("#endif\n");
                }
        }
-       printf("\tmpsafe = (%s%s->v_vflag & VV_MPSAFE);\n", argname[0], arg0special);
+       printf("\tmpsafe = (%s->v_vflag & VV_MPSAFE);\n", argname[0]);
        printf("\tif (!mpsafe) { KERNEL_LOCK(1, curlwp); }\n");
-       printf("\terror = (VCALL(%s%s, VOFFSET(%s), &a));\n",
-               argname[0], arg0special, name);
+       printf("\terror = (VCALL(%s, VOFFSET(%s), &a));\n",
+               argname[0], name);
        printf("\tif (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }\n");
        if (willmake != -1) {
                printf("#ifdef DIAGNOSTIC\n");
@@ -460,21 +449,8 @@
                bodynorm();
 }
 BEGIN  {
-       printf("\n/* Special cases: */\n");
        # start from 1 (vop_default is at 0)
        argc=1;
-       willmake=-1;
-       argdir[0]="IN";
-       argtype[0]="struct buf *";
-       argname[0]="bp";
-       lockstate[0] = -1;
-       arg0special="->b_vp";
-       willrele[0]=0;
-       name="vop_bwrite";
-       doit();
-       printf("\n/* End of special cases */\n");
-
-       arg0special="";
 }
 '"$awk_parser" | sed -e "$anal_retentive"
 
@@ -486,7 +462,6 @@
 echo "
 const struct vnodeop_desc * const ${rump}vfs_op_descs[] = {
        &${rump}vop_default_desc,       /* MUST BE FIRST */
-       &${rump}vop_bwrite_desc,        /* XXX: SPECIAL CASE */
 "
 
 # Body stuff
diff -r 0aed9a932562 -r 3410cdb54fb1 sys/kern/vnode_if.src
--- a/sys/kern/vnode_if.src     Mon Jul 11 08:22:49 2011 +0000
+++ b/sys/kern/vnode_if.src     Mon Jul 11 08:23:00 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: vnode_if.src,v 1.61 2011/04/02 23:05:50 rmind Exp $
+#      $NetBSD: vnode_if.src,v 1.62 2011/07/11 08:23:00 hannken Exp $
 #
 # Copyright (c) 1992, 1993
 #      The Regents of the University of California.  All rights reserved.
@@ -50,6 +50,14 @@
 # parameter, the flags required for the initial namei() call are listed.
 # Additional flags may be added to the namei() call, but these are required.
 #     
+
+#
+#% bwrite     vp      = = =
+#
+vop_bwrite {
+       IN struct vnode *vp;
+       IN struct buf *bp;
+};
  
 #
 #% lookup     dvp     L L L
@@ -457,13 +465,6 @@
 };
 
 #
-# Needs work: no vp?
-#
-#vop_bwrite {
-#      IN struct buf *bp;
-#};
-
-#
 #% getpages    vp = = =
 #
 vop_getpages {
@@ -516,6 +517,7 @@
        IN int attrnamespace;
        INOUT struct uio *uio;
        OUT size_t *size;
+       IN int flag;
        IN kauth_cred_t cred;
 };
 



Home | Main Index | Thread Index | Old Index