Collapse vnode->v_object and buf->b_object into bufobj->bo_object.

This commit is contained in:
Poul-Henning Kamp 2004-10-25 06:02:57 +00:00
parent ac582d7b7f
commit 4dcd0ac4cf
5 changed files with 10 additions and 9 deletions

View File

@ -1923,7 +1923,6 @@ restart:
bp->b_npages = 0; bp->b_npages = 0;
bp->b_dirtyoff = bp->b_dirtyend = 0; bp->b_dirtyoff = bp->b_dirtyend = 0;
bp->b_magic = B_MAGIC_BIO; bp->b_magic = B_MAGIC_BIO;
bp->b_object = NULL;
bp->b_bufobj = NULL; bp->b_bufobj = NULL;
LIST_INIT(&bp->b_dep); LIST_INIT(&bp->b_dep);
@ -2407,6 +2406,7 @@ getblk(struct vnode * vp, daddr_t blkno, int size, int slpflag, int slptimeo,
int s; int s;
int error; int error;
ASSERT_VOP_LOCKED(vp, "getblk"); ASSERT_VOP_LOCKED(vp, "getblk");
struct vm_object *vmo;
if (size > MAXBSIZE) if (size > MAXBSIZE)
panic("getblk: size(%d) > MAXBSIZE(%d)\n", size, MAXBSIZE); panic("getblk: size(%d) > MAXBSIZE(%d)\n", size, MAXBSIZE);
@ -2638,10 +2638,13 @@ loop:
printf("getblk: VMIO on vnode type %d\n", printf("getblk: VMIO on vnode type %d\n",
vp->v_type); vp->v_type);
#endif #endif
VOP_GETVOBJECT(vp, &bp->b_object); VOP_GETVOBJECT(vp, &vmo);
KASSERT(vmo == bp->b_object,
("ARGH! different b_object %p %p %p\n", bp, vmo, bp->b_object));
} else { } else {
bp->b_flags &= ~B_VMIO; bp->b_flags &= ~B_VMIO;
bp->b_object = NULL; KASSERT(bp->b_object == NULL,
("ARGH! has b_object %p %p\n", bp, bp->b_object));
} }
allocbuf(bp, size); allocbuf(bp, size);

View File

@ -1410,8 +1410,6 @@ brelvp(struct buf *bp)
vdropl(vp); vdropl(vp);
bp->b_vp = NULL; bp->b_vp = NULL;
bp->b_bufobj = NULL; bp->b_bufobj = NULL;
if (bp->b_object)
bp->b_object = NULL;
VI_UNLOCK(vp); VI_UNLOCK(vp);
} }
@ -1694,7 +1692,6 @@ pbgetvp(vp, bp)
KASSERT(bp->b_vp == NULL, ("pbgetvp: not free")); KASSERT(bp->b_vp == NULL, ("pbgetvp: not free"));
bp->b_vp = vp; bp->b_vp = vp;
bp->b_object = vp->v_object;
bp->b_flags |= B_PAGING; bp->b_flags |= B_PAGING;
bp->b_dev = vn_todev(vp); bp->b_dev = vn_todev(vp);
bp->b_bufobj = &vp->v_bufobj; bp->b_bufobj = &vp->v_bufobj;
@ -1722,7 +1719,6 @@ pbrelvp(bp)
} }
BO_UNLOCK(bp->b_bufobj); BO_UNLOCK(bp->b_bufobj);
bp->b_vp = NULL; bp->b_vp = NULL;
bp->b_object = NULL;
bp->b_bufobj = NULL; bp->b_bufobj = NULL;
bp->b_flags &= ~B_PAGING; bp->b_flags &= ~B_PAGING;
} }

View File

@ -126,7 +126,6 @@ struct buf {
int b_kvasize; /* size of kva for buffer */ int b_kvasize; /* size of kva for buffer */
daddr_t b_lblkno; /* Logical block number. */ daddr_t b_lblkno; /* Logical block number. */
struct vnode *b_vp; /* Device vnode. */ struct vnode *b_vp; /* Device vnode. */
struct vm_object *b_object; /* Object for vp */
int b_dirtyoff; /* Offset in buffer of dirty region. */ int b_dirtyoff; /* Offset in buffer of dirty region. */
int b_dirtyend; /* Offset of end of dirty region. */ int b_dirtyend; /* Offset of end of dirty region. */
struct ucred *b_rcred; /* Read credentials reference. */ struct ucred *b_rcred; /* Read credentials reference. */
@ -144,6 +143,8 @@ struct buf {
struct workhead b_dep; /* (D) List of filesystem dependencies. */ struct workhead b_dep; /* (D) List of filesystem dependencies. */
}; };
#define b_object b_bufobj->bo_object
/* /*
* These flags are kept in b_flags. * These flags are kept in b_flags.
* *

View File

@ -83,6 +83,7 @@ struct bufobj {
long bo_numoutput; /* i Writes in progress */ long bo_numoutput; /* i Writes in progress */
u_int bo_flag; /* i Flags */ u_int bo_flag; /* i Flags */
struct buf_ops *bo_ops; /* - buffer operatoins */ struct buf_ops *bo_ops; /* - buffer operatoins */
struct vm_object *bo_object; /* v Place to store VM object */
}; };
#define BO_WWAIT (1 << 1) /* Wait for output to complete */ #define BO_WWAIT (1 << 1) /* Wait for output to complete */

View File

@ -115,7 +115,6 @@ struct vnode {
struct bufobj v_bufobj; /* * Buffer cache object */ struct bufobj v_bufobj; /* * Buffer cache object */
u_long v_vflag; /* v vnode flags */ u_long v_vflag; /* v vnode flags */
int v_writecount; /* v ref count of writers */ int v_writecount; /* v ref count of writers */
struct vm_object *v_object; /* v Place to store VM object */
daddr_t v_lastw; /* v last write (write cluster) */ daddr_t v_lastw; /* v last write (write cluster) */
daddr_t v_cstart; /* v start block of cluster */ daddr_t v_cstart; /* v start block of cluster */
daddr_t v_lasta; /* v last allocation (cluster) */ daddr_t v_lasta; /* v last allocation (cluster) */
@ -164,6 +163,7 @@ struct vnode {
#define v_fifoinfo v_un.vu_fifoinfo #define v_fifoinfo v_un.vu_fifoinfo
/* XXX: These are temporary to avoid a source sweep at this time */ /* XXX: These are temporary to avoid a source sweep at this time */
#define v_object v_bufobj.bo_object
#define v_cleanblkhd v_bufobj.bo_clean.bv_hd #define v_cleanblkhd v_bufobj.bo_clean.bv_hd
#define v_cleanblkroot v_bufobj.bo_clean.bv_root #define v_cleanblkroot v_bufobj.bo_clean.bv_root
#define v_cleanbufcnt v_bufobj.bo_clean.bv_cnt #define v_cleanbufcnt v_bufobj.bo_clean.bv_cnt