Pull in IN_ACCESSED changes and some MNT_LAZY `bug fixes' from FFS.

This commit is contained in:
mycroft 2000-05-29 18:34:36 +00:00
parent edfd1e6f32
commit 33ec489188
2 changed files with 24 additions and 16 deletions

View File

@ -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 @@ ext2fs_inactive(v)
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 @@ ext2fs_update(v)
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_update(v)
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 @@ ext2fs_update(v)
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 {

View File

@ -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 @@ ext2fs_sync(mp, waitfor, cred, p)
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 @@ loop:
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 @@ loop:
/*
* Force stale file system control information to be flushed.
*/
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.
*/