diff options
author | attilio <attilio@FreeBSD.org> | 2013-02-20 10:38:34 +0000 |
---|---|---|
committer | attilio <attilio@FreeBSD.org> | 2013-02-20 10:38:34 +0000 |
commit | 658534ed5a02db4fef5b0630008502474d6c26d6 (patch) | |
tree | 567755b13eb4e24198cc8098e62ff4a975f8486c /sys/kern/vfs_bio.c | |
parent | 5dce0c1384f698b3a27a82e72e3cbcf49b325404 (diff) | |
download | FreeBSD-src-658534ed5a02db4fef5b0630008502474d6c26d6.zip FreeBSD-src-658534ed5a02db4fef5b0630008502474d6c26d6.tar.gz |
Switch vm_object lock to be a rwlock.
* VM_OBJECT_LOCK and VM_OBJECT_UNLOCK are mapped to write operations
* VM_OBJECT_SLEEP() is introduced as a general purpose primitve to
get a sleep operation using a VM_OBJECT_LOCK() as protection
* The approach must bear with vm_pager.h namespace pollution so many
files require including directly rwlock.h
Diffstat (limited to 'sys/kern/vfs_bio.c')
-rw-r--r-- | sys/kern/vfs_bio.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 6393399..d8ed908 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #include <sys/kthread.h> #include <sys/proc.h> #include <sys/resourcevar.h> +#include <sys/rwlock.h> #include <sys/sysctl.h> #include <sys/vmmeter.h> #include <sys/vnode.h> @@ -458,7 +459,7 @@ vfs_buf_test_cache(struct buf *bp, vm_page_t m) { - VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); + VM_OBJECT_LOCK_ASSERT(m->object, RA_WLOCKED); if (bp->b_flags & B_CACHE) { int base = (foff + off) & PAGE_MASK; if (vm_page_is_valid(m, base, size) == 0) @@ -2533,7 +2534,7 @@ vfs_setdirty_locked_object(struct buf *bp) int i; object = bp->b_bufobj->bo_object; - VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); + VM_OBJECT_LOCK_ASSERT(object, RA_WLOCKED); /* * We qualify the scan for modified pages on whether the @@ -3566,7 +3567,7 @@ vfs_drain_busy_pages(struct buf *bp) vm_page_t m; int i, last_busied; - VM_OBJECT_LOCK_ASSERT(bp->b_bufobj->bo_object, MA_OWNED); + VM_OBJECT_LOCK_ASSERT(bp->b_bufobj->bo_object, RA_WLOCKED); last_busied = 0; for (i = 0; i < bp->b_npages; i++) { m = bp->b_pages[i]; @@ -3719,7 +3720,7 @@ vfs_bio_clrbuf(struct buf *bp) if (bp->b_pages[0] == bogus_page) goto unlock; mask = (1 << (bp->b_bufsize / DEV_BSIZE)) - 1; - VM_OBJECT_LOCK_ASSERT(bp->b_pages[0]->object, MA_OWNED); + VM_OBJECT_LOCK_ASSERT(bp->b_pages[0]->object, RA_WLOCKED); if ((bp->b_pages[0]->valid & mask) == mask) goto unlock; if ((bp->b_pages[0]->valid & mask) == 0) { @@ -3738,7 +3739,7 @@ vfs_bio_clrbuf(struct buf *bp) continue; j = ((vm_offset_t)sa & PAGE_MASK) / DEV_BSIZE; mask = ((1 << ((ea - sa) / DEV_BSIZE)) - 1) << j; - VM_OBJECT_LOCK_ASSERT(bp->b_pages[i]->object, MA_OWNED); + VM_OBJECT_LOCK_ASSERT(bp->b_pages[i]->object, RA_WLOCKED); if ((bp->b_pages[i]->valid & mask) == mask) continue; if ((bp->b_pages[i]->valid & mask) == 0) |