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

This commit is contained in:
phk 2004-10-25 06:02:57 +00:00
parent ad9026d0bd
commit 4ba53ec41b
5 changed files with 10 additions and 9 deletions

View File

@ -1923,7 +1923,6 @@ getnewbuf(int slpflag, int slptimeo, int size, int maxsize)
bp->b_npages = 0;
bp->b_dirtyoff = bp->b_dirtyend = 0;
bp->b_magic = B_MAGIC_BIO;
bp->b_object = NULL;
bp->b_bufobj = NULL;
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 error;
ASSERT_VOP_LOCKED(vp, "getblk");
struct vm_object *vmo;
if (size > MAXBSIZE)
panic("getblk: size(%d) > MAXBSIZE(%d)\n", size, MAXBSIZE);
@ -2638,10 +2638,13 @@ getblk(struct vnode * vp, daddr_t blkno, int size, int slpflag, int slptimeo,
printf("getblk: VMIO on vnode type %d\n",
vp->v_type);
#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 {
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);

View File

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

View File

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

View File

@ -83,6 +83,7 @@ struct bufobj {
long bo_numoutput; /* i Writes in progress */
u_int bo_flag; /* i Flags */
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 */

View File

@ -115,7 +115,6 @@ struct vnode {
struct bufobj v_bufobj; /* * Buffer cache object */
u_long v_vflag; /* v vnode flags */
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_cstart; /* v start block of cluster */
daddr_t v_lasta; /* v last allocation (cluster) */
@ -164,6 +163,7 @@ struct vnode {
#define v_fifoinfo v_un.vu_fifoinfo
/* 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_cleanblkroot v_bufobj.bo_clean.bv_root
#define v_cleanbufcnt v_bufobj.bo_clean.bv_cnt