Move pbgetvp() and pbrelvp() to vm_pager.c with the rest of the pbuf stuff.

This commit is contained in:
Poul-Henning Kamp 2004-11-15 08:12:50 +00:00
parent e8a7bef39e
commit a752aa8f17
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=137721
2 changed files with 44 additions and 46 deletions

View File

@ -1690,52 +1690,6 @@ syncer_shutdown(void *arg, int howto)
kproc_shutdown(arg, howto);
}
/*
* Associate a p-buffer with a vnode.
*
* Also sets B_PAGING flag to indicate that vnode is not fully associated
* with the buffer. i.e. the bp has not been linked into the vnode or
* ref-counted.
*/
void
pbgetvp(vp, bp)
register struct vnode *vp;
register struct buf *bp;
{
KASSERT(bp->b_vp == NULL, ("pbgetvp: not free"));
bp->b_vp = vp;
bp->b_flags |= B_PAGING;
bp->b_bufobj = &vp->v_bufobj;
}
/*
* Disassociate a p-buffer from a vnode.
*/
void
pbrelvp(bp)
register struct buf *bp;
{
KASSERT(bp->b_vp != NULL, ("pbrelvp: NULL"));
KASSERT(bp->b_bufobj != NULL, ("pbrelvp: NULL bufobj"));
/* XXX REMOVE ME */
BO_LOCK(bp->b_bufobj);
if (TAILQ_NEXT(bp, b_bobufs) != NULL) {
panic(
"relpbuf(): b_vp was probably reassignbuf()d %p %x",
bp,
(int)bp->b_flags
);
}
BO_UNLOCK(bp->b_bufobj);
bp->b_vp = NULL;
bp->b_bufobj = NULL;
bp->b_flags &= ~B_PAGING;
}
/*
* Reassign a buffer from one vnode to another.
* Used to assign file specific control information

View File

@ -420,3 +420,47 @@ relpbuf(bp, pfreecnt)
mtx_unlock(&pbuf_mtx);
splx(s);
}
/*
* Associate a p-buffer with a vnode.
*
* Also sets B_PAGING flag to indicate that vnode is not fully associated
* with the buffer. i.e. the bp has not been linked into the vnode or
* ref-counted.
*/
void
pbgetvp(struct vnode *vp, struct buf *bp)
{
KASSERT(bp->b_vp == NULL, ("pbgetvp: not free"));
bp->b_vp = vp;
bp->b_flags |= B_PAGING;
bp->b_bufobj = &vp->v_bufobj;
}
/*
* Disassociate a p-buffer from a vnode.
*/
void
pbrelvp(struct buf *bp)
{
KASSERT(bp->b_vp != NULL, ("pbrelvp: NULL"));
KASSERT(bp->b_bufobj != NULL, ("pbrelvp: NULL bufobj"));
/* XXX REMOVE ME */
BO_LOCK(bp->b_bufobj);
if (TAILQ_NEXT(bp, b_bobufs) != NULL) {
panic(
"relpbuf(): b_vp was probably reassignbuf()d %p %x",
bp,
(int)bp->b_flags
);
}
BO_UNLOCK(bp->b_bufobj);
bp->b_vp = NULL;
bp->b_bufobj = NULL;
bp->b_flags &= ~B_PAGING;
}