summaryrefslogtreecommitdiffstats
path: root/sys/vm
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-11-15 08:12:50 +0000
committerphk <phk@FreeBSD.org>2004-11-15 08:12:50 +0000
commitca008fe1710db893e5a8b7a8793ff2c5a0e2d9ee (patch)
treea2bf9e7710089298157a8dec321ec9ed2b0e2e49 /sys/vm
parent4d081241bd2f6debe1b8385dc5259eb7bb911cb4 (diff)
downloadFreeBSD-src-ca008fe1710db893e5a8b7a8793ff2c5a0e2d9ee.zip
FreeBSD-src-ca008fe1710db893e5a8b7a8793ff2c5a0e2d9ee.tar.gz
Move pbgetvp() and pbrelvp() to vm_pager.c with the rest of the pbuf stuff.
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm_pager.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c
index 5d15827..90cde2d 100644
--- a/sys/vm/vm_pager.c
+++ b/sys/vm/vm_pager.c
@@ -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;
+}
+
OpenPOWER on IntegriCloud