Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-4]: src/sys/ufs/lfs Pull up revision 1.31 (via patch, requested...
details: https://anonhg.NetBSD.org/src/rev/b6c506518f69
branches: netbsd-1-4
changeset: 470097:b6c506518f69
user: he <he%NetBSD.org@localhost>
date: Thu Jan 20 21:01:11 2000 +0000
description:
Pull up revision 1.31 (via patch, requested by perseant):
Files removed (through unlink, rmdir) are now really removed, though the
removal is postponed until the dirop is complete to ensure validity of
the filesystem through a crash. Use a separate per-fs lock, instead of
ufs_hashlock, to protect the inode free list. Change calling semantics
of lfs_ifind, to give better error reporting: If fed a struct buf, it
can report the block number of the offending inode block as well as the
inode number.
diffstat:
sys/ufs/lfs/lfs_alloc.c | 21 ++++++++-------------
1 files changed, 8 insertions(+), 13 deletions(-)
diffs (74 lines):
diff -r 268b1ac3c662 -r b6c506518f69 sys/ufs/lfs/lfs_alloc.c
--- a/sys/ufs/lfs/lfs_alloc.c Thu Jan 20 21:00:49 2000 +0000
+++ b/sys/ufs/lfs/lfs_alloc.c Thu Jan 20 21:01:11 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_alloc.c,v 1.18.2.7 2000/01/15 17:55:11 he Exp $ */
+/* $NetBSD: lfs_alloc.c,v 1.18.2.8 2000/01/20 21:01:11 he Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -122,11 +122,9 @@
fs = VTOI(ap->a_pvp)->i_lfs;
/*
- * Prevent a race getting lfs_free. We use
- * the ufs_hashlock here because we need that anyway for
- * the hash insertion later.
+ * Prevent a race getting lfs_free.
*/
- lockmgr(&ufs_hashlock, LK_EXCLUSIVE, 0);
+ lockmgr(&fs->lfs_freelock, LK_EXCLUSIVE, 0);
/* Get the head of the freelist. */
new_ino = fs->lfs_free;
@@ -185,16 +183,17 @@
ifp->if_nextfree = LFS_UNUSED_INUM;
VOP_UNLOCK(vp,0);
if ((error = VOP_BWRITE(bp)) != 0) {
- lockmgr(&ufs_hashlock, LK_RELEASE, 0);
return (error);
}
}
-
#ifdef DIAGNOSTIC
if(fs->lfs_free == LFS_UNUSED_INUM)
panic("inode 0 allocated [3]");
#endif /* DIAGNOSTIC */
+ lockmgr(&fs->lfs_freelock, LK_RELEASE, 0);
+
+ lockmgr(&ufs_hashlock, LK_EXCLUSIVE, 0);
/* Create a vnode to associate with the inode. */
if ((error = lfs_vcreate(ap->a_pvp->v_mount, new_ino, &vp)) != 0) {
lockmgr(&ufs_hashlock, LK_RELEASE, 0);
@@ -300,7 +299,6 @@
struct lfs *fs;
ufs_daddr_t old_iaddr;
ino_t ino;
- int already_locked;
extern int lfs_dirvcount;
/* Get the inode number and file system. */
@@ -309,11 +307,9 @@
fs = ip->i_lfs;
ino = ip->i_number;
- /* If we already hold ufs_hashlock, don't panic, just do it anyway */
- already_locked = lockstatus(&ufs_hashlock) && ufs_hashlock.lk_lockholder == curproc->p_pid;
while(WRITEINPROG(vp)
|| fs->lfs_seglock
- || (!already_locked && lockmgr(&ufs_hashlock, LK_EXCLUSIVE|LK_SLEEPFAIL, 0)))
+ || lockmgr(&fs->lfs_freelock, LK_EXCLUSIVE|LK_SLEEPFAIL, 0))
{
if (WRITEINPROG(vp)) {
tsleep(vp, (PRIBIO+1), "lfs_vfree", 0);
@@ -375,8 +371,7 @@
sup->su_nbytes -= DINODE_SIZE;
(void) VOP_BWRITE(bp);
}
- if(!already_locked)
- lockmgr(&ufs_hashlock, LK_RELEASE, 0);
+ lockmgr(&fs->lfs_freelock, LK_RELEASE, 0);
/* Set superblock modified bit and decrement file count. */
fs->lfs_fmod = 1;
Home |
Main Index |
Thread Index |
Old Index