Author: mjg
Date: Fri Sep 30 17:11:03 2016
New Revision: 306509
URL: https://svnweb.freebsd.org/changeset/base/306509

Log:
  vfs: remove the __bo_vnode field from struct vnode
  
  The pointer can be obtained using __containerof instead.
  
  Reviewed by:  kib

Modified:
  head/sys/fs/nandfs/nandfs_subr.c
  head/sys/kern/vfs_bio.c
  head/sys/kern/vfs_subr.c
  head/sys/sys/bufobj.h
  head/sys/sys/vnode.h
  head/sys/ufs/ffs/ffs_snapshot.c
  head/sys/ufs/ffs/ffs_vfsops.c

Modified: head/sys/fs/nandfs/nandfs_subr.c
==============================================================================
--- head/sys/fs/nandfs/nandfs_subr.c    Fri Sep 30 16:35:30 2016        
(r306508)
+++ head/sys/fs/nandfs/nandfs_subr.c    Fri Sep 30 17:11:03 2016        
(r306509)
@@ -80,7 +80,7 @@ nandfs_bufsync(struct bufobj *bo, int wa
        struct vnode *vp;
        int error = 0;
 
-       vp = bo->__bo_vnode;
+       vp = bo2vnode(bo);
 
        ASSERT_VOP_LOCKED(vp, __func__);
        error = nandfs_sync_file(vp);

Modified: head/sys/kern/vfs_bio.c
==============================================================================
--- head/sys/kern/vfs_bio.c     Fri Sep 30 16:35:30 2016        (r306508)
+++ head/sys/kern/vfs_bio.c     Fri Sep 30 17:11:03 2016        (r306509)
@@ -4544,7 +4544,7 @@ int
 bufsync(struct bufobj *bo, int waitfor)
 {
 
-       return (VOP_FSYNC(bo->__bo_vnode, waitfor, curthread));
+       return (VOP_FSYNC(bo2vnode(bo), waitfor, curthread));
 }
 
 void

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c    Fri Sep 30 16:35:30 2016        (r306508)
+++ head/sys/kern/vfs_subr.c    Fri Sep 30 17:11:03 2016        (r306509)
@@ -372,7 +372,6 @@ vnode_init(void *mem, int size, int flag
         * Initialize bufobj.
         */
        bo = &vp->v_bufobj;
-       bo->__bo_vnode = vp;
        rw_init(BO_LOCKPTR(bo), "bufobj interlock");
        bo->bo_private = vp;
        TAILQ_INIT(&bo->bo_clean.bv_hd);
@@ -2052,7 +2051,7 @@ sync_vnode(struct synclist *slp, struct 
        *bo = LIST_FIRST(slp);
        if (*bo == NULL)
                return (0);
-       vp = (*bo)->__bo_vnode; /* XXX */
+       vp = bo2vnode(*bo);
        if (VOP_ISLOCKED(vp) != 0 || VI_TRYLOCK(vp) == 0)
                return (1);
        /*

Modified: head/sys/sys/bufobj.h
==============================================================================
--- head/sys/sys/bufobj.h       Fri Sep 30 16:35:30 2016        (r306508)
+++ head/sys/sys/bufobj.h       Fri Sep 30 17:11:03 2016        (r306509)
@@ -94,11 +94,6 @@ struct bufobj {
        struct vm_object *bo_object;    /* v Place to store VM object */
        LIST_ENTRY(bufobj) bo_synclist; /* S dirty vnode list */
        void            *bo_private;    /* private pointer */
-       struct vnode    *__bo_vnode;    /*
-                                        * XXX: This vnode pointer is here
-                                        * XXX: only to keep the syncer working
-                                        * XXX: for now.
-                                        */
        struct bufv     bo_clean;       /* i Clean buffers */
        struct bufv     bo_dirty;       /* i Dirty buffers */
        long            bo_numoutput;   /* i Writes in progress */

Modified: head/sys/sys/vnode.h
==============================================================================
--- head/sys/sys/vnode.h        Fri Sep 30 16:35:30 2016        (r306508)
+++ head/sys/sys/vnode.h        Fri Sep 30 17:11:03 2016        (r306509)
@@ -179,6 +179,8 @@ struct vnode {
 #define        v_rdev          v_un.vu_cdev
 #define        v_fifoinfo      v_un.vu_fifoinfo
 
+#define        bo2vnode(bo)    __containerof((bo), struct vnode, v_bufobj)
+
 /* XXX: These are temporary to avoid a source sweep at this time */
 #define v_object       v_bufobj.bo_object
 

Modified: head/sys/ufs/ffs/ffs_snapshot.c
==============================================================================
--- head/sys/ufs/ffs/ffs_snapshot.c     Fri Sep 30 16:35:30 2016        
(r306508)
+++ head/sys/ufs/ffs/ffs_snapshot.c     Fri Sep 30 17:11:03 2016        
(r306509)
@@ -2170,7 +2170,7 @@ ffs_bdflush(bo, bp)
 
        td = curthread;
        vp = bp->b_vp;
-       devvp = bo->__bo_vnode;
+       devvp = bo2vnode(bo);
        KASSERT(vp == devvp, ("devvp != vp %p %p", bo, bp));
 
        VI_LOCK(devvp);

Modified: head/sys/ufs/ffs/ffs_vfsops.c
==============================================================================
--- head/sys/ufs/ffs/ffs_vfsops.c       Fri Sep 30 16:35:30 2016        
(r306508)
+++ head/sys/ufs/ffs/ffs_vfsops.c       Fri Sep 30 17:11:03 2016        
(r306509)
@@ -2177,7 +2177,7 @@ ffs_geom_strategy(struct bufobj *bo, str
        struct buf *tbp;
        int nocopy;
 
-       vp = bo->__bo_vnode;
+       vp = bo2vnode(bo);
        if (bp->b_iocmd == BIO_WRITE) {
                if ((bp->b_flags & B_VALIDSUSPWRT) == 0 &&
                    bp->b_vp != NULL && bp->b_vp->v_mount != NULL &&
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to