aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_lock.c
diff options
context:
space:
mode:
authorKirk McKusick <mckusick@FreeBSD.org>1999-06-26 02:47:16 +0000
committerKirk McKusick <mckusick@FreeBSD.org>1999-06-26 02:47:16 +0000
commit67812eacd74d5841e890b703d4ec2d5a76288830 (patch)
treedaad70481467b7aa233a8f5e919b7eec6d7cc908 /sys/kern/kern_lock.c
parent5a903f8d735f0cc4a378e9f85fa3ad30a675df06 (diff)
downloadsrc-67812eacd74d5841e890b703d4ec2d5a76288830.tar.gz
src-67812eacd74d5841e890b703d4ec2d5a76288830.zip
Convert buffer locking from using the B_BUSY and B_WANTED flags to using
lockmgr locks. This commit should be functionally equivalent to the old semantics. That is, all buffer locking is done with LK_EXCLUSIVE requests. Changes to take advantage of LK_SHARED and LK_RECURSIVE will be done in future commits.
Notes
Notes: svn path=/head/; revision=48225
Diffstat (limited to 'sys/kern/kern_lock.c')
-rw-r--r--sys/kern/kern_lock.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c
index 3dde4b8c03e0..c7e9c84350e4 100644
--- a/sys/kern/kern_lock.c
+++ b/sys/kern/kern_lock.c
@@ -38,7 +38,7 @@
* SUCH DAMAGE.
*
* @(#)kern_lock.c 8.18 (Berkeley) 5/21/95
- * $Id: kern_lock.c,v 1.24 1999/03/12 03:09:29 julian Exp $
+ * $Id: kern_lock.c,v 1.25 1999/03/15 05:11:27 julian Exp $
*/
#include "opt_lint.h"
@@ -384,7 +384,8 @@ debuglockmgr(lkp, flags, interlkp, p, name, file, line)
case LK_RELEASE:
if (lkp->lk_exclusivecount != 0) {
#if !defined(MAX_PERF)
- if (pid != lkp->lk_lockholder)
+ if (lkp->lk_lockholder != pid &&
+ lkp->lk_lockholder != LK_KERNPROC)
panic("lockmgr: pid %d, not %s %d unlocking",
pid, "exclusive lock holder",
lkp->lk_lockholder);
@@ -518,6 +519,21 @@ lockstatus(lkp)
}
/*
+ * Determine the number of holders of a lock.
+ */
+int
+lockcount(lkp)
+ struct lock *lkp;
+{
+ int count;
+
+ simple_lock(&lkp->lk_interlock);
+ count = lkp->lk_exclusivecount + lkp->lk_sharecount;
+ simple_unlock(&lkp->lk_interlock);
+ return (count);
+}
+
+/*
* Print out information about state of a lock. Used by VOP_PRINT
* routines to display status about contained locks.
*/