diff --git a/sys/fs/nandfs/nandfs_subr.c b/sys/fs/nandfs/nandfs_subr.c index c9780a5..97c3857 100644 --- a/sys/fs/nandfs/nandfs_subr.c +++ b/sys/fs/nandfs/nandfs_subr.c @@ -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); diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index cb9ee9a..7469a9633 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -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 diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 8c1acd9..47c2cff 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -377,7 +377,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); @@ -2123,7 +2122,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); /* diff --git a/sys/sys/bufobj.h b/sys/sys/bufobj.h index 0fa6c8c..657702c 100644 --- a/sys/sys/bufobj.h +++ b/sys/sys/bufobj.h @@ -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 */ diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 90329ed..6783b54 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -180,6 +180,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 diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c index a303c8d..549c44e 100644 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -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); diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index d8790d1..46dbdb1 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -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 &&