diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2015-06-23 06:12:14 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2015-06-23 06:12:14 +0000 |
commit | b05c401ff68275ba4139861a825c545cc7464da4 (patch) | |
tree | edb49987c271ae2c36a29e9e8f58d496aa026120 /sys/kern/vfs_bio.c | |
parent | dbbf46c40c3d9d32ef663aa6c7e212be207e2061 (diff) | |
download | src-b05c401ff68275ba4139861a825c545cc7464da4.tar.gz src-b05c401ff68275ba4139861a825c545cc7464da4.zip |
Only take previous buffer queue lock (olock) when needed for REMFREE
in binsfree().
Submitted by: Conrad Meyer
Sponsored by: EMC / Isilon Storage Division
Review: https://reviews.freebsd.org/D2882
MFC after: 1 week
Notes
Notes:
svn path=/head/; revision=284719
Diffstat (limited to 'sys/kern/vfs_bio.c')
-rw-r--r-- | sys/kern/vfs_bio.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 5ac04acfb0d9..c715725f9266 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -994,21 +994,23 @@ binsfree(struct buf *bp, int qindex) BUF_ASSERT_XLOCKED(bp); - olock = bqlock(bp->b_qindex); nlock = bqlock(qindex); - mtx_lock(olock); /* Handle delayed bremfree() processing. */ - if (bp->b_flags & B_REMFREE) + if (bp->b_flags & B_REMFREE) { + olock = bqlock(bp->b_qindex); + mtx_lock(olock); bremfreel(bp); + if (olock != nlock) { + mtx_unlock(olock); + mtx_lock(nlock); + } + } else + mtx_lock(nlock); if (bp->b_qindex != QUEUE_NONE) panic("binsfree: free buffer onto another queue???"); bp->b_qindex = qindex; - if (olock != nlock) { - mtx_unlock(olock); - mtx_lock(nlock); - } if (bp->b_flags & B_AGE) TAILQ_INSERT_HEAD(&bufqueues[bp->b_qindex], bp, b_freelist); else |