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
This commit is contained in:
Konstantin Belousov 2015-06-23 06:12:14 +00:00
parent dbbf46c40c
commit b05c401ff6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=284719

View File

@ -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