summaryrefslogtreecommitdiffstats
path: root/sys/vm
diff options
context:
space:
mode:
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm_pager.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c
index a8d061a..87f74d8 100644
--- a/sys/vm/vm_pager.c
+++ b/sys/vm/vm_pager.c
@@ -442,6 +442,24 @@ pbgetvp(struct vnode *vp, struct buf *bp)
}
/*
+ * 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
+pbgetbo(struct bufobj *bo, struct buf *bp)
+{
+
+ KASSERT(bp->b_vp == NULL, ("pbgetbo: not free (vnode)"));
+ KASSERT(bp->b_bufobj == NULL, ("pbgetbo: not free (bufobj)"));
+
+ bp->b_flags |= B_PAGING;
+ bp->b_bufobj = bo;
+}
+
+/*
* Disassociate a p-buffer from a vnode.
*/
void
@@ -465,3 +483,27 @@ pbrelvp(struct buf *bp)
bp->b_bufobj = NULL;
bp->b_flags &= ~B_PAGING;
}
+
+/*
+ * Disassociate a p-buffer from a bufobj.
+ */
+void
+pbrelbo(struct buf *bp)
+{
+
+ KASSERT(bp->b_vp == NULL, ("pbrelbo: vnode"));
+ KASSERT(bp->b_bufobj != NULL, ("pbrelbo: 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_bufobj = NULL;
+ bp->b_flags &= ~B_PAGING;
+}
OpenPOWER on IntegriCloud