Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ufs/ext2fs Pull in IN_ACCESSED changes and some MNT_LAZY...
details: https://anonhg.NetBSD.org/src/rev/48d248a8a5eb
branches: trunk
changeset: 486847:48d248a8a5eb
user: mycroft <mycroft%NetBSD.org@localhost>
date: Mon May 29 18:34:36 2000 +0000
description:
Pull in IN_ACCESSED changes and some MNT_LAZY `bug fixes' from FFS.
diffstat:
sys/ufs/ext2fs/ext2fs_inode.c | 14 +++++++++-----
sys/ufs/ext2fs/ext2fs_vfsops.c | 26 +++++++++++++++-----------
2 files changed, 24 insertions(+), 16 deletions(-)
diffs (114 lines):
diff -r 187dac3060a5 -r 48d248a8a5eb sys/ufs/ext2fs/ext2fs_inode.c
--- a/sys/ufs/ext2fs/ext2fs_inode.c Mon May 29 18:28:48 2000 +0000
+++ b/sys/ufs/ext2fs/ext2fs_inode.c Mon May 29 18:34:36 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ext2fs_inode.c,v 1.17 2000/05/28 08:44:32 mycroft Exp $ */
+/* $NetBSD: ext2fs_inode.c,v 1.18 2000/05/29 18:34:36 mycroft Exp $ */
/*
* Copyright (c) 1997 Manuel Bouyer.
@@ -96,7 +96,7 @@
ip->i_flag |= IN_CHANGE | IN_UPDATE;
VOP_VFREE(vp, ip->i_number, ip->i_e2fs_mode);
}
- if (ip->i_flag & (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE))
+ if (ip->i_flag & (IN_ACCESS | IN_CHANGE | IN_UPDATE | IN_MODIFIED | IN_ACCESSED))
VOP_UPDATE(vp, NULL, NULL, 0);
out:
VOP_UNLOCK(vp, 0);
@@ -135,6 +135,7 @@
int error;
struct timespec ts;
caddr_t cp;
+ int flags;
if (ap->a_vp->v_mount->mnt_flag & MNT_RDONLY)
return (0);
@@ -143,10 +144,12 @@
EXT2FS_ITIMES(ip,
ap->a_access ? ap->a_access : &ts,
ap->a_modify ? ap->a_modify : &ts, &ts);
- if ((ip->i_flag & IN_MODIFIED) == 0)
+ flags = ip->i_flag & (IN_MODIFIED | IN_ACCESSED);
+ if (flags == 0)
return (0);
- ip->i_flag &= ~IN_MODIFIED;
+ ip->i_flag &= ~flags;
fs = ip->i_e2fs;
+
error = bread(ip->i_devvp,
fsbtodb(fs, ino_to_fsba(fs, ip->i_number)),
(int)fs->e2fs_bsize, NOCRED, &bp);
@@ -157,7 +160,8 @@
cp = (caddr_t)bp->b_data +
(ino_to_fsbo(fs, ip->i_number) * EXT2_DINODE_SIZE);
e2fs_isave(&ip->i_din.e2fs_din, (struct ext2fs_dinode *)cp);
- if ((ap->a_flags & (UPDATE_WAIT|UPDATE_DIROP)) &&
+ if ((ap->a_flags & (UPDATE_WAIT|UPDATE_DIROP)) != 0&&
+ (flags & IN_MODIFIED) != 0 &&
(ap->a_vp->v_mount->mnt_flag & MNT_ASYNC) == 0)
return (bwrite(bp));
else {
diff -r 187dac3060a5 -r 48d248a8a5eb sys/ufs/ext2fs/ext2fs_vfsops.c
--- a/sys/ufs/ext2fs/ext2fs_vfsops.c Mon May 29 18:28:48 2000 +0000
+++ b/sys/ufs/ext2fs/ext2fs_vfsops.c Mon May 29 18:34:36 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ext2fs_vfsops.c,v 1.35 2000/03/30 12:41:11 augustss Exp $ */
+/* $NetBSD: ext2fs_vfsops.c,v 1.36 2000/05/29 18:34:36 mycroft Exp $ */
/*
* Copyright (c) 1997 Manuel Bouyer.
@@ -749,17 +749,16 @@
int error, allerror = 0;
fs = ump->um_e2fs;
- if (fs->e2fs_ronly != 0) { /* XXX */
+ if (fs->e2fs_fmod != 0 && fs->e2fs_ronly != 0) { /* XXX */
printf("fs = %s\n", fs->e2fs_fsmnt);
panic("update: rofs mod");
}
-
/*
* Write back each (modified) inode.
*/
simple_lock(&mntvnode_slock);
loop:
- for (vp = mp->mnt_vnodelist.lh_first; vp != NULL; vp = nvp) {
+ for (vp = LIST_FIRST(&mp->mnt_vnodelist); vp != NULL; vp = nvp) {
/*
* If the vnode that we are about to sync is no longer
* associated with this mount point, start over.
@@ -767,11 +766,12 @@
if (vp->v_mount != mp)
goto loop;
simple_lock(&vp->v_interlock);
- nvp = vp->v_mntvnodes.le_next;
+ nvp = LIST_NEXT(vp, v_mntvnodes);
ip = VTOI(vp);
- if (vp->v_type == VNON || ((ip->i_flag &
- (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0 &&
- (vp->v_dirtyblkhd.lh_first == NULL || waitfor == MNT_LAZY)))
+ if (vp->v_type == VNON ||
+ ((ip->i_flag &
+ (IN_ACCESS | IN_CHANGE | IN_UPDATE | IN_MODIFIED | IN_ACCESSED)) == 0 &&
+ LIST_EMPTY(&vp->v_dirtyblkhd)))
{
simple_unlock(&vp->v_interlock);
continue;
@@ -794,9 +794,13 @@
/*
* Force stale file system control information to be flushed.
*/
- if ((error = VOP_FSYNC(ump->um_devvp, cred,
- waitfor == MNT_WAIT ? FSYNC_WAIT : 0, p)) != 0)
- allerror = error;
+ if (waitfor != MNT_LAZY) {
+ vn_lock(ump->um_devvp, LK_EXCLUSIVE | LK_RETRY);
+ if ((error = VOP_FSYNC(ump->um_devvp, cred,
+ waitfor == MNT_WAIT ? FSYNC_WAIT : 0, p)) != 0)
+ allerror = error;
+ VOP_UNLOCK(ump->um_devvp, 0);
+ }
/*
* Write back modified superblock.
*/
Home |
Main Index |
Thread Index |
Old Index