vfs: remove the __bo_vnode field from struct vnode

The pointer can be obtained using __containerof instead.

Reviewed by:	kib
This commit is contained in:
Mateusz Guzik 2016-09-30 17:11:03 +00:00
parent 63ecbc6b55
commit 8660b707ff
7 changed files with 7 additions and 11 deletions

View File

@ -80,7 +80,7 @@ nandfs_bufsync(struct bufobj *bo, int waitfor)
struct vnode *vp;
int error = 0;
vp = bo->__bo_vnode;
vp = bo2vnode(bo);
ASSERT_VOP_LOCKED(vp, __func__);
error = nandfs_sync_file(vp);

View File

@ -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

View File

@ -372,7 +372,6 @@ vnode_init(void *mem, int size, int flags)
* 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 bufobj **bo, struct thread *td)
*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);
/*

View File

@ -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 */

View File

@ -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

View File

@ -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);

View File

@ -2177,7 +2177,7 @@ ffs_geom_strategy(struct bufobj *bo, struct buf *bp)
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 &&