On 12/24/12 11:24 AM, Adrian Chadd wrote:
... why'd we break the KBI in a stable branch?

I am not sure either.

I think a single VOP for nullfs (while ugly) would have sufficed.

I have a partial patch here that shows the direction I was going.

What's left is to:
shim #defines for -stable to route the "new" vops from -current (VOP_ISTEXT, VOP_WRITECOUNT..) into just plain #defines inside of vnode.h to call into VOP_NULLFS_CALLTHROUGH with the proper VOP_NULLFS_IS_TEXT/VOP_NULLFS_SET_TEXT and remap stuff around into struct vop_nullfs_callthrough_args. best way to do this would be to just copy the code from the -current vnode_if.h into sys/vnode.h and hack it up for that it maps properly.

Partial patch attached.

-Alfred


Adrian


On 24 December 2012 06:22, Konstantin Belousov <k...@freebsd.org> wrote:
Author: kib
Date: Mon Dec 24 14:22:52 2012
New Revision: 244663
URL: http://svnweb.freebsd.org/changeset/base/244663

Log:
   Note that filesystem modules must be recompiled.

Modified:
   stable/9/UPDATING

Modified: stable/9/UPDATING
==============================================================================
--- stable/9/UPDATING   Mon Dec 24 14:12:43 2012        (r244662)
+++ stable/9/UPDATING   Mon Dec 24 14:22:52 2012        (r244663)
@@ -11,6 +11,11 @@ handbook:
  Items affecting the ports and packages system can be found in
  /usr/ports/UPDATING.  Please read that file before running portupgrade.

+20121224:
+       The VFS KBI was changed with the merge of several nullfs
+       optimizations and fixes.  All filesystem modules must be
+       recompiled.
+
  20121218:
         With the addition of auditdistd(8), a new auditdistd user is now
         depended on during installworld.  "mergemaster -p" can be used to add

diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c
index fd2437b..f109bc8 100644
--- a/sys/kern/vfs_default.c
+++ b/sys/kern/vfs_default.c
@@ -78,6 +78,8 @@ static int    dirent_exists(struct vnode *vp, const char 
*dirname,
 
 #define DIRENT_MINSIZE (sizeof(struct dirent) - (MAXNAMLEN+1) + 4)
 
+static int vop_nullfs_callthrough(struct vop_nullfs_callthrough_args *ap);
+
 static int vop_stdis_text(struct vop_is_text_args *ap);
 static int vop_stdset_text(struct vop_set_text_args *ap);
 static int vop_stdunset_text(struct vop_unset_text_args *ap);
@@ -132,11 +134,7 @@ struct vop_vector default_vnodeops = {
        .vop_unp_bind =         vop_stdunp_bind,
        .vop_unp_connect =      vop_stdunp_connect,
        .vop_unp_detach =       vop_stdunp_detach,
-       .vop_is_text =          vop_stdis_text,
-       .vop_set_text =         vop_stdset_text,
-       .vop_unset_text =       vop_stdunset_text,
-       .vop_get_writecount =   vop_stdget_writecount,
-       .vop_add_writecount =   vop_stdadd_writecount,
+       .vop_nullfs_callthrough =   vop_stdnullfs_callthrough,
 };
 
 /*
@@ -1085,6 +1083,54 @@ vop_stdunp_detach(struct vop_unp_detach_args *ap)
 }
 
 static int
+vop_stdnullfs_callthrough(struct vop_nullfs_callthrough_args *ap)
+{
+
+       switch (ap->a_op) {
+       case VOP_NULLFS_IS_TEXT:
+               {
+                       struct vop_is_text_args ap2;
+                       ap2.a_vp = ap->a_vp;
+                       return vop_stdis_text(&ap2);
+               }
+       case VOP_NULLFS_SET_TEXT:
+               {
+                       struct vop_set_text_args ap2;
+                       ap2.a_vp = ap->a_vp;
+                       return vop_stdset_text(&ap2);
+               }
+       case VOP_NULLFS_UNSET_TEXT:
+               {
+                       struct vop_unset_text_args ap2;
+                       ap2.a_vp = ap->a_vp;
+                       return vop_stdunset_text(&ap2);
+               }
+       case VOP_NULLFS_GET_WRITECOUNT:
+               {
+                       struct vop_get_writecount_args ap2;
+                       int error;
+                       int writecount;
+
+                       ap2.a_vp = ap->a_vp;
+                       ap2.a_writecount = &writecount;
+                       error = vop_stdget_writecount(&ap2);
+                       *((int *)ap->a_out0) = writecount;
+                       return (error);
+               }
+       case VOP_NULLFS_ADD_WRITECOUNT:
+               {
+                       struct vop_add_writecount_args ap2;
+
+                       ap2.a_vp = ap->a_vp;
+                       ap2.a_inc = ap->a_in0;
+                       return vop_stdadd_writecount(&ap2);
+               }
+       default:
+               return (EOPNOTSUPP);
+       }
+}
+
+static int
 vop_stdis_text(struct vop_is_text_args *ap)
 {
 
diff --git a/sys/kern/vnode_if.src b/sys/kern/vnode_if.src
index 194e9f8..2bcc80a 100644
--- a/sys/kern/vnode_if.src
+++ b/sys/kern/vnode_if.src
@@ -658,36 +658,12 @@ vop_unp_detach {
        IN struct vnode *vp;
 };
 
-%% is_text     vp      L L L
+%% nullfs_callthrough  vp  = = =
 
-vop_is_text {
+vop_nullfs_callthrough {
        IN struct vnode *vp;
-};
-
-%% set_text    vp      E E E
-
-vop_set_text {
-       IN struct vnode *vp;
-};
-
-%% vop_unset_text      vp      E E E
-
-vop_unset_text {
-       IN struct vnode *vp;
-};
-
-%% get_writecount      vp      L L L
-
-vop_get_writecount {
-       IN struct vnode *vp;
-       OUT int *writecount;
-};
-
-%% add_writecount      vp      E E E
-
-vop_add_writecount {
-       IN struct vnode *vp;
-       IN int inc;
+       IN  uintptr_t in0;
+       OUT uintptr_t *out0;
 };
 
 # The VOPs below are spares at the end of the table to allow new VOPs to be
@@ -695,10 +671,6 @@ vop_add_writecount {
 # be added above these spares.  When merging a new VOP to a stable branch,
 # the new VOP should replace one of the spares.
 
-vop_spare4 {
-       IN struct vnode *vp;
-};
-
 vop_spare5 {
        IN struct vnode *vp;
 };
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to