Not enough OK's, and from the wrong people. You should know how to do
authorderaadt <deraadt@openbsd.org>
Mon, 19 Jul 2010 21:13:43 +0000 (21:13 +0000)
committerderaadt <deraadt@openbsd.org>
Mon, 19 Jul 2010 21:13:43 +0000 (21:13 +0000)
collaborative development by now, Owain

sys/ufs/ufs/ufs_ihash.c

index 737206c..58412f0 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ufs_ihash.c,v 1.15 2010/07/19 20:58:21 oga Exp $      */
+/*     $OpenBSD: ufs_ihash.c,v 1.16 2010/07/19 21:13:43 deraadt Exp $  */
 /*     $NetBSD: ufs_ihash.c,v 1.3 1996/02/09 22:36:04 christos Exp $   */
 
 /*
@@ -36,7 +36,6 @@
 #include <sys/systm.h>
 #include <sys/vnode.h>
 #include <sys/malloc.h>
-#include <sys/mutex.h>
 #include <sys/proc.h>
 
 #include <ufs/ufs/quota.h>
@@ -49,7 +48,6 @@
 LIST_HEAD(ihashhead, inode) *ihashtbl;
 u_long ihash;          /* size of hash table - 1 */
 #define        INOHASH(device, inum)   (&ihashtbl[((device) + (inum)) & ihash])
-struct mutex ihash_mtx = MUTEX_INITIALIZER(IPL_NONE);
 
 /*
  * Initialize inode hash table.
@@ -69,11 +67,11 @@ ufs_ihashlookup(dev_t dev, ino_t inum)
 {
         struct inode *ip;
 
-       mtx_enter(&ihash_mtx);
+       /* XXXLOCKING lock hash list */
        LIST_FOREACH(ip, INOHASH(dev, inum), i_hash)
                if (inum == ip->i_number && dev == ip->i_dev)
                        break;
-       mtx_leave(&ihash_mtx);
+       /* XXXLOCKING unlock hash list? */
 
        if (ip)
                return (ITOV(ip));
@@ -92,17 +90,17 @@ ufs_ihashget(dev_t dev, ino_t inum)
        struct inode *ip;
        struct vnode *vp;
 loop:
-       mtx_enter(&ihash_mtx);
+       /* XXXLOCKING lock hash list */
        LIST_FOREACH(ip, INOHASH(dev, inum), i_hash) {
                if (inum == ip->i_number && dev == ip->i_dev) {
                        vp = ITOV(ip);
-                       mtx_leave(&ihash_mtx);
+                       /* XXXLOCKING unlock hash list? */
                        if (vget(vp, LK_EXCLUSIVE, p))
                                goto loop;
                        return (vp);
                }
        }
-       mtx_leave(&ihash_mtx);
+       /* XXXLOCKING unlock hash list? */
        return (NULL);
 }
 
@@ -120,11 +118,11 @@ ufs_ihashins(struct inode *ip)
        /* lock the inode, then put it on the appropriate hash list */
        lockmgr(&ip->i_lock, LK_EXCLUSIVE, NULL);
 
-       mtx_enter(&ihash_mtx);
+       /* XXXLOCKING lock hash list */
 
        LIST_FOREACH(curip, INOHASH(dev, inum), i_hash) {
                if (inum == curip->i_number && dev == curip->i_dev) {
-                       mtx_leave(&ihash_mtx);
+                       /* XXXLOCKING unlock hash list? */
                        lockmgr(&ip->i_lock, LK_RELEASE, NULL);
                        return (EEXIST);
                }
@@ -132,7 +130,7 @@ ufs_ihashins(struct inode *ip)
 
        ipp = INOHASH(dev, inum);
        LIST_INSERT_HEAD(ipp, ip, i_hash);
-       mtx_leave(&ihash_mtx);
+       /* XXXLOCKING unlock hash list? */
 
        return (0);
 }
@@ -143,7 +141,7 @@ ufs_ihashins(struct inode *ip)
 void
 ufs_ihashrem(struct inode *ip)
 {
-       mtx_enter(&ihash_mtx);
+       /* XXXLOCKING lock hash list */
 
        if (ip->i_hash.le_prev == NULL)
                return;
@@ -153,5 +151,5 @@ ufs_ihashrem(struct inode *ip)
        ip->i_hash.le_next = NULL;
        ip->i_hash.le_prev = NULL;
 #endif
-       mtx_leave(&ihash_mtx);
+       /* XXXLOCKING unlock hash list? */
 }