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.25 (requested by perseant):
details: https://anonhg.NetBSD.org/src/rev/d33545218ff4
branches: netbsd-1-4
changeset: 469885:d33545218ff4
user: he <he%NetBSD.org@localhost>
date: Fri Dec 17 23:21:56 1999 +0000
description:
Pull up revision 1.25 (requested by perseant):
Avoid flushing vnodes involved in a dirop, making lfs' promise
of "no fsck needed, even in the event of a crash" closer to
reality.
diffstat:
sys/ufs/lfs/lfs_inode.c | 24 +++++++++++++++++++++---
1 files changed, 21 insertions(+), 3 deletions(-)
diffs (52 lines):
diff -r 70b2aa1fa32a -r d33545218ff4 sys/ufs/lfs/lfs_inode.c
--- a/sys/ufs/lfs/lfs_inode.c Fri Dec 17 23:21:30 1999 +0000
+++ b/sys/ufs/lfs/lfs_inode.c Fri Dec 17 23:21:56 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_inode.c,v 1.22.2.2 1999/06/25 20:51:00 perry Exp $ */
+/* $NetBSD: lfs_inode.c,v 1.22.2.3 1999/12/17 23:21:56 he Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -128,6 +128,7 @@
struct vnode *vp = ap->a_vp;
int mod, oflag;
struct timespec ts;
+ struct lfs *fs = VFSTOUFS(vp->v_mount)->um_lfs;
if (vp->v_mount->mnt_flag & MNT_RDONLY)
return (0);
@@ -142,7 +143,7 @@
*/
while((ap->a_waitfor & LFS_SYNC) && WRITEINPROG(vp)) {
#ifdef DEBUG_LFS
- printf("lfs_update: sleeping on inode %d\n",ip->i_number);
+ printf("lfs_update: sleeping on inode %d (in-progress)\n",ip->i_number);
#endif
tsleep(vp, (PRIBIO+1), "lfs_update", 0);
}
@@ -159,7 +160,24 @@
}
/* If sync, push back the vnode and any dirty blocks it may have. */
- return (ap->a_waitfor & LFS_SYNC ? lfs_vflush(vp) : 0);
+ if(ap->a_waitfor & LFS_SYNC) {
+ /* Avoid flushing VDIROP. */
+ ++fs->lfs_diropwait;
+ while(vp->v_flag & VDIROP) {
+#ifdef DEBUG_LFS
+ printf("lfs_update: sleeping on inode %d (dirops)\n",ip->i_number);
+#endif
+ if(fs->lfs_dirops==0)
+ lfs_flush_fs(vp->v_mount,0);
+ else
+ tsleep(&fs->lfs_writer, PRIBIO+1, "lfs_fsync", 0);
+ /* XXX KS - by falling out here, are we writing the vn
+ twice? */
+ }
+ --fs->lfs_diropwait;
+ return lfs_vflush(vp);
+ }
+ return 0;
}
/* Update segment usage information when removing a block. */
Home |
Main Index |
Thread Index |
Old Index