-/* $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 $ */
/*
#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>
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.
{
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));
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);
}
/* 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);
}
ipp = INOHASH(dev, inum);
LIST_INSERT_HEAD(ipp, ip, i_hash);
- mtx_leave(&ihash_mtx);
+ /* XXXLOCKING unlock hash list? */
return (0);
}
void
ufs_ihashrem(struct inode *ip)
{
- mtx_enter(&ihash_mtx);
+ /* XXXLOCKING lock hash list */
if (ip->i_hash.le_prev == NULL)
return;
ip->i_hash.le_next = NULL;
ip->i_hash.le_prev = NULL;
#endif
- mtx_leave(&ihash_mtx);
+ /* XXXLOCKING unlock hash list? */
}