summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2012-11-18 16:56:42 +0000
committerBob Beck <beck@cvs.openbsd.org>2012-11-18 16:56:42 +0000
commit2e0e75c225e57631bfa49f67d7e25617436fea8b (patch)
tree03051034c4b7103d605336f1c413d66e5be709f8 /sys/kern
parent0e94671412c59a1bcf6f69279a1bea633ec682de (diff)
These functions all should be called with splbio, so splassert(IPL_BIO)
everywhere instead of setting splbio. ok krw@ pirofti@
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/vfs_biomem.c43
1 files changed, 9 insertions, 34 deletions
diff --git a/sys/kern/vfs_biomem.c b/sys/kern/vfs_biomem.c
index c0149d83624..13a8051a515 100644
--- a/sys/kern/vfs_biomem.c
+++ b/sys/kern/vfs_biomem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_biomem.c,v 1.19 2012/11/17 23:08:22 beck Exp $ */
+/* $OpenBSD: vfs_biomem.c,v 1.20 2012/11/18 16:56:41 beck Exp $ */
/*
* Copyright (c) 2007 Artur Grabowski <art@openbsd.org>
*
@@ -42,8 +42,6 @@ extern struct bcachestats bcstats;
* wraparound. Even if you reuse 4GB worth of buffers every second
* you'll still run out of time_t faster than buffers.
*
- * XXX - the spl locking in here is extreme paranoia right now until I figure
- * it all out.
*/
voff_t buf_page_offset;
struct uvm_object *buf_object, buf_object_store;
@@ -76,18 +74,13 @@ buf_mem_init(vsize_t size)
void
buf_acquire(struct buf *bp)
{
- int s;
-
KASSERT((bp->b_flags & B_BUSY) == 0);
-
- s = splbio();
+ splassert(IPL_BIO);
/*
* Busy before waiting for kvm.
*/
SET(bp->b_flags, B_BUSY);
buf_map(bp);
-
- splx(s);
}
/*
@@ -98,11 +91,8 @@ buf_acquire(struct buf *bp)
void
buf_acquire_unmapped(struct buf *bp)
{
- int s;
-
- s = splbio();
+ splassert(IPL_BIO);
SET(bp->b_flags, B_BUSY|B_NOTMAPPED);
- splx(s);
}
/*
@@ -177,12 +167,11 @@ buf_map(struct buf *bp)
void
buf_release(struct buf *bp)
{
- int s;
KASSERT(bp->b_flags & B_BUSY);
KASSERT((bp->b_data != NULL) || (bp->b_flags & B_NOTMAPPED));
+ splassert(IPL_BIO);
- s = splbio();
if (bp->b_data) {
bcstats.busymapped--;
TAILQ_INSERT_TAIL(&buf_valist, bp, b_valist);
@@ -193,7 +182,6 @@ buf_release(struct buf *bp)
}
}
CLR(bp->b_flags, B_BUSY|B_NOTMAPPED);
- splx(s);
}
/*
@@ -211,9 +199,8 @@ int
buf_dealloc_mem(struct buf *bp)
{
caddr_t data;
- int s;
- s = splbio();
+ splassert(IPL_BIO);
data = bp->b_data;
bp->b_data = NULL;
@@ -228,10 +215,8 @@ buf_dealloc_mem(struct buf *bp)
if (bp->b_pobj)
buf_free_pages(bp);
- if (data == NULL) {
- splx(s);
+ if (data == NULL)
return (0);
- }
bp->b_data = data;
if (!(bp->b_flags & B_BUSY)) { /* XXX - need better test */
@@ -242,7 +227,6 @@ buf_dealloc_mem(struct buf *bp)
SET(bp->b_flags, B_RELEASED);
TAILQ_INSERT_HEAD(&buf_valist, bp, b_valist);
bcstats.kvaslots_avail++;
- splx(s);
return (1);
}
@@ -270,12 +254,11 @@ vaddr_t
buf_unmap(struct buf *bp)
{
vaddr_t va;
- int s;
KASSERT((bp->b_flags & B_BUSY) == 0);
KASSERT(bp->b_data != NULL);
+ splassert(IPL_BIO);
- s = splbio();
TAILQ_REMOVE(&buf_valist, bp, b_valist);
bcstats.kvaslots_avail--;
va = (vaddr_t)bp->b_data;
@@ -286,8 +269,6 @@ buf_unmap(struct buf *bp)
if (bp->b_flags & B_RELEASED)
pool_put(&bufpool, bp);
- splx(s);
-
return (va);
}
@@ -296,13 +277,11 @@ void
buf_alloc_pages(struct buf *bp, vsize_t size)
{
voff_t offs;
- int s;
KASSERT(size == round_page(size));
KASSERT(bp->b_pobj == NULL);
KASSERT(bp->b_data == NULL);
-
- s = splbio();
+ splassert(IPL_BIO);
offs = buf_page_offset;
buf_page_offset += size;
@@ -314,7 +293,6 @@ buf_alloc_pages(struct buf *bp, vsize_t size)
bp->b_pobj = buf_object;
bp->b_poffs = offs;
bp->b_bufsize = size;
- splx(s);
}
void
@@ -323,12 +301,10 @@ buf_free_pages(struct buf *bp)
struct uvm_object *uobj = bp->b_pobj;
struct vm_page *pg;
voff_t off, i;
- int s;
KASSERT(bp->b_data == NULL);
KASSERT(uobj != NULL);
-
- s = splbio();
+ splassert(IPL_BIO);
off = bp->b_poffs;
bp->b_pobj = NULL;
@@ -342,7 +318,6 @@ buf_free_pages(struct buf *bp)
uvm_pagefree(pg);
bcstats.numbufpages--;
}
- splx(s);
}
/*