summaryrefslogtreecommitdiffstats
path: root/sys/vm
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-11-15 08:47:18 +0000
committerphk <phk@FreeBSD.org>2004-11-15 08:47:18 +0000
commit6809658d1c9ca4eeca1cc691f6104b6ac431e296 (patch)
tree74134ead96d34023d81c56ba7ad945e31ced7964 /sys/vm
parentce936d6e832ad1d8ad97ad7d014ea94ff2ea989b (diff)
downloadFreeBSD-src-6809658d1c9ca4eeca1cc691f6104b6ac431e296.zip
FreeBSD-src-6809658d1c9ca4eeca1cc691f6104b6ac431e296.tar.gz
Add pbgetbo()/pbrelbo() lighter weight versions of pbgetvp()/pbrelvp().
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