diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2007-03-30 00:38:57 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2007-03-30 00:38:57 +0000 |
commit | 66db9b99ad3aab37a6573213a76f34f254c167d3 (patch) | |
tree | b24a2aa62824b067aa11b2b56bd525936691cd64 | |
parent | 301cac1db0dca8870ea9f3cb23e47b2bd8082a8f (diff) |
replace lockmgr locks with rwlocks. these are no longer recursive, but they
weren't used recursively anyway.
tested by hsoexer@ fkr@ ok pedro@
-rw-r--r-- | sys/kern/subr_disk.c | 9 | ||||
-rw-r--r-- | sys/sys/disk.h | 6 |
2 files changed, 7 insertions, 8 deletions
diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c index c44d80def42..9f42ca832fd 100644 --- a/sys/kern/subr_disk.c +++ b/sys/kern/subr_disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_disk.c,v 1.33 2007/03/27 18:04:01 thib Exp $ */ +/* $OpenBSD: subr_disk.c,v 1.34 2007/03/30 00:38:56 dlg Exp $ */ /* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */ /* @@ -261,8 +261,7 @@ disk_find(char *name) int disk_construct(struct disk *diskp, char *lockname) { - lockinit(&diskp->dk_lock, PRIBIO | PCATCH, lockname, - 0, LK_CANRECURSE); + rw_init(&diskp->dk_lock, lockname); diskp->dk_flags |= DKF_CONSTRUCTED; @@ -382,7 +381,7 @@ disk_lock(struct disk *dk) { int error; - error = lockmgr(&dk->dk_lock, LK_EXCLUSIVE, NULL); + error = rw_enter(&dk->dk_lock, RW_WRITE|RW_INTR); return (error); } @@ -390,7 +389,7 @@ disk_lock(struct disk *dk) void disk_unlock(struct disk *dk) { - lockmgr(&dk->dk_lock, LK_RELEASE, NULL); + rw_exit(&dk->dk_lock); } /* diff --git a/sys/sys/disk.h b/sys/sys/disk.h index 0d1931d8972..11846ee90ed 100644 --- a/sys/sys/disk.h +++ b/sys/sys/disk.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disk.h,v 1.13 2006/03/15 20:20:42 miod Exp $ */ +/* $OpenBSD: disk.h,v 1.14 2007/03/30 00:38:56 dlg Exp $ */ /* $NetBSD: disk.h,v 1.11 1996/04/28 20:22:50 thorpej Exp $ */ /* @@ -50,7 +50,7 @@ #include <sys/time.h> #include <sys/queue.h> -#include <sys/lock.h> +#include <sys/rwlock.h> struct buf; struct disklabel; @@ -73,7 +73,7 @@ struct diskstats { struct disk { TAILQ_ENTRY(disk) dk_link; /* link in global disklist */ - struct lock dk_lock; /* disk lock */ + struct rwlock dk_lock; /* disk lock */ char *dk_name; /* disk name */ int dk_flags; /* disk flags */ #define DKF_CONSTRUCTED 0x0001 |