summaryrefslogtreecommitdiff
path: root/kernel/bio.c
diff options
context:
space:
mode:
authorFrans Kaashoek <[email protected]>2019-07-30 08:54:43 -0400
committerFrans Kaashoek <[email protected]>2019-07-30 08:54:43 -0400
commitf37a3e396454268074f48517e3773f099846d0e3 (patch)
treec0885b4e2009f26fe13046137008bfdfd69648c4 /kernel/bio.c
parentf1bb53c690051994f5a2c43ee900f9e335bd019c (diff)
downloadxv6-labs-f37a3e396454268074f48517e3773f099846d0e3.tar.gz
xv6-labs-f37a3e396454268074f48517e3773f099846d0e3.tar.bz2
xv6-labs-f37a3e396454268074f48517e3773f099846d0e3.zip
Make pin/unpin explicit
Diffstat (limited to 'kernel/bio.c')
-rw-r--r--kernel/bio.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/kernel/bio.c b/kernel/bio.c
index 7455c06..a1074f2 100644
--- a/kernel/bio.c
+++ b/kernel/bio.c
@@ -133,3 +133,19 @@ brelse(struct buf *b)
release(&bcache.lock);
}
+
+void
+bpin(struct buf *b) {
+ acquire(&bcache.lock);
+ b->refcnt++;
+ release(&bcache.lock);
+}
+
+void
+bunpin(struct buf *b) {
+ acquire(&bcache.lock);
+ b->refcnt--;
+ release(&bcache.lock);
+}
+
+