diff options
author | alc <alc@FreeBSD.org> | 2006-10-28 19:16:57 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2006-10-28 19:16:57 +0000 |
commit | b944aa0079dcd240d119399fa424b4eef66a3019 (patch) | |
tree | 6d39194da8378c878200911c05fc2a6e9d20b46b | |
parent | c1bb665f0e7acb3474f7a29f69d7b0912e2c6800 (diff) | |
download | FreeBSD-src-b944aa0079dcd240d119399fa424b4eef66a3019.zip FreeBSD-src-b944aa0079dcd240d119399fa424b4eef66a3019.tar.gz |
In bufdone_finish() restrict the acquisition and release of the page
queues lock to BIO_READ operations. Recent changes to the implementation
of the per-page flags have eliminated the need for the page queues lock
in the other cases.
-rw-r--r-- | sys/kern/vfs_bio.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 2e6e8ec..d747c1d 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -3167,6 +3167,7 @@ bufdone_finish(struct buf *bp) vm_object_t obj; int iosize; struct vnode *vp = bp->b_vp; + boolean_t are_queues_locked; obj = bp->b_bufobj->bo_object; @@ -3203,7 +3204,11 @@ bufdone_finish(struct buf *bp) !(bp->b_ioflags & BIO_ERROR)) { bp->b_flags |= B_CACHE; } - vm_page_lock_queues(); + if (bp->b_iocmd == BIO_READ) { + vm_page_lock_queues(); + are_queues_locked = TRUE; + } else + are_queues_locked = FALSE; for (i = 0; i < bp->b_npages; i++) { int bogusflag = 0; int resid; @@ -3272,7 +3277,8 @@ bufdone_finish(struct buf *bp) foff = (foff + PAGE_SIZE) & ~(off_t)PAGE_MASK; iosize -= resid; } - vm_page_unlock_queues(); + if (are_queues_locked) + vm_page_unlock_queues(); vm_object_pip_wakeupn(obj, 0); VM_OBJECT_UNLOCK(obj); } |