Take out the `#ifdef USE_UFSHASH'; use ufs_hashlock to lock the inode free
list instead of free_lock.
This commit is contained in:
parent
16092bb979
commit
6a87896854
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_alloc.c,v 1.18 1999/03/24 05:51:30 mrg Exp $ */
|
||||
/* $NetBSD: lfs_alloc.c,v 1.19 1999/04/11 23:24:04 perseant Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
@ -94,11 +94,7 @@
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_extern.h>
|
||||
|
||||
#ifndef USE_UFS_HASHLOCK
|
||||
int free_lock = 0;
|
||||
#else
|
||||
extern struct lock ufs_hashlock;
|
||||
#endif
|
||||
|
||||
/* Allocate a new inode. */
|
||||
/* ARGSUSED */
|
||||
@ -129,14 +125,8 @@ lfs_valloc(v)
|
||||
* (this should be a proper lock, in struct lfs)
|
||||
*/
|
||||
|
||||
#ifndef USE_UFS_HASHLOCK
|
||||
while(free_lock)
|
||||
tsleep(&free_lock, PRIBIO+1, "lfs_free", 0);
|
||||
free_lock++;
|
||||
#else
|
||||
while(lockmgr(&ufs_hashlock, LK_EXCLUSIVE|LK_SLEEPFAIL, 0))
|
||||
;
|
||||
#endif
|
||||
|
||||
/* Get the head of the freelist. */
|
||||
new_ino = fs->lfs_free;
|
||||
@ -190,22 +180,11 @@ lfs_valloc(v)
|
||||
ifp->if_nextfree = LFS_UNUSED_INUM;
|
||||
VOP_UNLOCK(vp,0);
|
||||
if ((error = VOP_BWRITE(bp)) != 0) {
|
||||
#ifndef USE_UFS_HASHLOCK
|
||||
free_lock--;
|
||||
wakeup(&free_lock);
|
||||
#else
|
||||
lockmgr(&ufs_hashlock, LK_RELEASE, 0);
|
||||
#endif
|
||||
return (error);
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef USE_UFS_HASHLOCK
|
||||
free_lock--;
|
||||
wakeup(&free_lock);
|
||||
#else
|
||||
lockmgr(&ufs_hashlock, LK_RELEASE, 0);
|
||||
#endif
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if(fs->lfs_free == LFS_UNUSED_INUM)
|
||||
@ -321,33 +300,19 @@ lfs_vfree(v)
|
||||
|
||||
while(WRITEINPROG(ap->a_pvp)
|
||||
|| fs->lfs_seglock
|
||||
#ifndef USE_UFS_HASHLOCK
|
||||
|| free_lock
|
||||
#else
|
||||
|| lockmgr(&ufs_hashlock, LK_EXCLUSIVE|LK_SLEEPFAIL, 0)
|
||||
#endif
|
||||
)
|
||||
|| lockmgr(&ufs_hashlock, LK_EXCLUSIVE|LK_SLEEPFAIL, 0))
|
||||
{
|
||||
if (WRITEINPROG(ap->a_pvp)) {
|
||||
tsleep(ap->a_pvp, (PRIBIO+1), "lfs_vfree", 0);
|
||||
}
|
||||
if(free_lock)
|
||||
tsleep(&free_lock, PRIBIO+1, "free_lock", 0);
|
||||
if (fs->lfs_seglock) {
|
||||
if (fs->lfs_lockpid == curproc->p_pid) {
|
||||
#if 0
|
||||
panic("lfs_vfree: we hold the seglock");
|
||||
#else
|
||||
break;
|
||||
#endif
|
||||
} else {
|
||||
tsleep(&fs->lfs_seglock, PRIBIO + 1, "lfs_vfr1", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifndef USE_UFS_HASHLOCK
|
||||
free_lock++;
|
||||
#endif
|
||||
|
||||
if (ip->i_flag & IN_CLEANING) {
|
||||
--fs->lfs_uinodes;
|
||||
@ -392,12 +357,7 @@ lfs_vfree(v)
|
||||
sup->su_nbytes -= DINODE_SIZE;
|
||||
(void) VOP_BWRITE(bp);
|
||||
}
|
||||
#ifndef USE_UFS_HASHLOCK
|
||||
free_lock--;
|
||||
wakeup(&free_lock);
|
||||
#else
|
||||
lockmgr(&ufs_hashlock, LK_RELEASE, 0);
|
||||
#endif
|
||||
|
||||
/* Set superblock modified bit and decrement file count. */
|
||||
fs->lfs_fmod = 1;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_syscalls.c,v 1.26 1999/03/29 22:13:07 perseant Exp $ */
|
||||
/* $NetBSD: lfs_syscalls.c,v 1.27 1999/04/11 23:24:04 perseant Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
@ -875,9 +875,7 @@ lfs_segwait(p, v, retval)
|
||||
* In either case we lfs_vref, and it is the caller's responsibility to
|
||||
* lfs_vunref and VOP_UNLOCK (if necessary) when finished.
|
||||
*/
|
||||
#ifdef USE_UFS_HASHLOCK
|
||||
extern struct lock ufs_hashlock;
|
||||
#endif
|
||||
|
||||
int
|
||||
lfs_fastvget(mp, ino, daddr, vpp, dinp, need_unlock)
|
||||
@ -903,24 +901,19 @@ lfs_fastvget(mp, ino, daddr, vpp, dinp, need_unlock)
|
||||
* locked, in which case they are going to be distinctly unhappy
|
||||
* if we trash something.
|
||||
*/
|
||||
#ifdef USE_UFS_HASHLOCK
|
||||
do {
|
||||
#endif
|
||||
if ((*vpp = ufs_ihashlookup(dev, ino)) != NULL) {
|
||||
lfs_vref(*vpp);
|
||||
if ((*vpp)->v_flag & VXLOCK) {
|
||||
printf("vnode VXLOCKed for ino %d\n",ino);
|
||||
printf("lfs_fastvget: vnode VXLOCKed for ino %d\n",ino);
|
||||
clean_vnlocked++;
|
||||
#ifdef LFS_EAGAIN_FAIL
|
||||
#if 0 /* XXXX KS */
|
||||
lfs_vunref(*vpp);
|
||||
#endif
|
||||
return EAGAIN;
|
||||
#endif
|
||||
}
|
||||
ip = VTOI(*vpp);
|
||||
lfs_vref(*vpp);
|
||||
if (VOP_ISLOCKED(*vpp)) {
|
||||
printf("ino %d inlocked by pid %d\n",ip->i_number,
|
||||
printf("lfs_fastvget: ino %d inlocked by pid %d\n",ip->i_number,
|
||||
ip->i_lock.lk_lockholder);
|
||||
clean_inlocked++;
|
||||
#ifdef LFS_EAGAIN_FAIL
|
||||
@ -933,16 +926,12 @@ lfs_fastvget(mp, ino, daddr, vpp, dinp, need_unlock)
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
#ifdef USE_UFS_HASHLOCK
|
||||
} while (lockmgr(&ufs_hashlock, LK_EXCLUSIVE|LK_SLEEPFAIL, 0));
|
||||
#endif
|
||||
|
||||
/* Allocate new vnode/inode. */
|
||||
if ((error = lfs_vcreate(mp, ino, &vp)) != 0) {
|
||||
*vpp = NULL;
|
||||
#ifdef USE_UFS_HASHLOCK
|
||||
lockmgr(&ufs_hashlock, LK_RELEASE, 0);
|
||||
#endif
|
||||
return (error);
|
||||
}
|
||||
/*
|
||||
@ -953,9 +942,7 @@ lfs_fastvget(mp, ino, daddr, vpp, dinp, need_unlock)
|
||||
*/
|
||||
ip = VTOI(vp);
|
||||
ufs_ihashins(ip);
|
||||
#ifdef USE_UFS_HASHLOCK
|
||||
lockmgr(&ufs_hashlock, LK_RELEASE, 0);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX
|
||||
|
Loading…
Reference in New Issue
Block a user