diff options
author | kib <kib@FreeBSD.org> | 2015-06-30 05:53:15 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2015-06-30 05:53:15 +0000 |
commit | 6499094e0c6da1d7926b476c2879f1ac97eece6a (patch) | |
tree | 989e36ecd59607ba81449121b794960a9a32c7de | |
parent | dc74c25d76650bd202bd7f6677ed03a0667533c4 (diff) | |
download | FreeBSD-src-6499094e0c6da1d7926b476c2879f1ac97eece6a.zip FreeBSD-src-6499094e0c6da1d7926b476c2879f1ac97eece6a.tar.gz |
MFC r284719:
Only take previous buffer queue lock (olock) when needed for REMFREE
in binsfree().
-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 8a359a9..63f9a34 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -963,21 +963,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 |