summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2010-04-23 19:32:58 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2010-04-23 19:32:58 +0000
commit40c3518aefd420580d257271e0b1dd4f1bcf779f (patch)
tree0083da64aa4df4e9b42681753fc568369621c86f /sys
parentd669d153f2100a81a300aacda2a00ebad1c5727a (diff)
It is about time that we stopped pretending simple_locks are locks.
replace ntfs_nthash_slock usage with comments prefixed XXXLOCKING (for grepability). This lock looks to be correct, but it could well be the bad way to do it (having a rwlock for inserts to avoid races inserting the same inode but then simple locking on list accesses). approach discussed with deraadt@
Diffstat (limited to 'sys')
-rw-r--r--sys/ntfs/ntfs_ihash.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/sys/ntfs/ntfs_ihash.c b/sys/ntfs/ntfs_ihash.c
index 190f73fa843..de2f7575875 100644
--- a/sys/ntfs/ntfs_ihash.c
+++ b/sys/ntfs/ntfs_ihash.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntfs_ihash.c,v 1.6 2009/08/13 16:00:53 jasper Exp $ */
+/* $OpenBSD: ntfs_ihash.c,v 1.7 2010/04/23 19:32:57 oga Exp $ */
/* $NetBSD: ntfs_ihash.c,v 1.1 2002/12/23 17:38:32 jdolecek Exp $ */
/*
@@ -36,7 +36,6 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
-#include <sys/lock.h>
#include <sys/rwlock.h>
#include <sys/vnode.h>
#include <sys/malloc.h>
@@ -57,9 +56,6 @@ MALLOC_DEFINE(M_NTFSNTHASH, "NTFS nthash", "NTFS ntnode hash tables");
static LIST_HEAD(nthashhead, ntnode) *ntfs_nthashtbl;
static u_long ntfs_nthash; /* size of hash table - 1 */
#define NTNOHASH(device, inum) ((minor(device) + (inum)) & ntfs_nthash)
-#ifndef NULL_SIMPLELOCKS
-static struct simplelock ntfs_nthash_slock;
-#endif
struct rwlock ntfs_hashlock = RWLOCK_INITIALIZER("ntfs_nthashlock");
/*
@@ -70,7 +66,6 @@ ntfs_nthashinit()
{
ntfs_nthashtbl = HASHINIT(desiredvnodes, M_NTFSNTHASH, M_WAITOK,
&ntfs_nthash);
- simple_lock_init(&ntfs_nthash_slock);
}
/*
@@ -85,13 +80,13 @@ ntfs_nthashlookup(dev, inum)
struct ntnode *ip;
struct nthashhead *ipp;
- simple_lock(&ntfs_nthash_slock);
+ /* XXXLOCKING lock hash list? */
ipp = &ntfs_nthashtbl[NTNOHASH(dev, inum)];
LIST_FOREACH(ip, ipp, i_hash) {
if (inum == ip->i_number && dev == ip->i_dev)
break;
}
- simple_unlock(&ntfs_nthash_slock);
+ /* XXXLOCKING unlock hash list? */
return (ip);
}
@@ -105,11 +100,11 @@ ntfs_nthashins(ip)
{
struct nthashhead *ipp;
- simple_lock(&ntfs_nthash_slock);
+ /* XXXLOCKING lock hash list? */
ipp = &ntfs_nthashtbl[NTNOHASH(ip->i_dev, ip->i_number)];
LIST_INSERT_HEAD(ipp, ip, i_hash);
ip->i_flag |= IN_HASHED;
- simple_unlock(&ntfs_nthash_slock);
+ /* XXXLOCKING unlock hash list? */
}
/*
@@ -119,10 +114,10 @@ void
ntfs_nthashrem(ip)
struct ntnode *ip;
{
- simple_lock(&ntfs_nthash_slock);
+ /* XXXLOCKING lock hash list? */
if (ip->i_flag & IN_HASHED) {
ip->i_flag &= ~IN_HASHED;
LIST_REMOVE(ip, i_hash);
}
- simple_unlock(&ntfs_nthash_slock);
+ /* XXXLOCKING unlock hash list? */
}