diff options
author | dyson <dyson@FreeBSD.org> | 1998-02-01 01:59:12 +0000 |
---|---|---|
committer | dyson <dyson@FreeBSD.org> | 1998-02-01 01:59:12 +0000 |
commit | 1d361dc623b0ce8b1559a9861ffe0313a175d5de (patch) | |
tree | eeaf0af014d3745c3c133d8c86659b504029950b | |
parent | 2a227e28011ea078b3715f7bce42bc5a81cb144b (diff) | |
download | FreeBSD-src-1d361dc623b0ce8b1559a9861ffe0313a175d5de.zip FreeBSD-src-1d361dc623b0ce8b1559a9861ffe0313a175d5de.tar.gz |
Support more intelligent sync operations for MNT_NOATIME.
PR: kern/5577
Submitted by: Craig Leres <leres@ee.lbl.gov>
-rw-r--r-- | sys/ufs/ffs/ffs_inode.c | 8 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_vfsops.c | 12 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_vnops.c | 19 |
3 files changed, 31 insertions, 8 deletions
diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index 77f72d3..6b64ece 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ffs_inode.c 8.13 (Berkeley) 4/21/95 - * $Id: ffs_inode.c,v 1.29 1997/10/16 20:32:34 phk Exp $ + * $Id: ffs_inode.c,v 1.30 1998/01/06 05:23:36 dyson Exp $ */ #include "opt_quota.h" @@ -87,9 +87,15 @@ ffs_update(vp, access, modify, waitfor) ~(IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE); return (0); } + + if (vp->v_mount->mnt_flag & MNT_NOATIME) { + ip->i_flag &=~ IN_ACCESS; + } + if ((ip->i_flag & (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0) return (0); + /* * Use a copy of the current time to get consistent timestamps * (a_access and a_modify are sometimes aliases for &time). diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index f4a20e8..d4f7df8 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ffs_vfsops.c 8.31 (Berkeley) 5/20/95 - * $Id: ffs_vfsops.c,v 1.65 1998/01/17 09:16:43 dyson Exp $ + * $Id: ffs_vfsops.c,v 1.66 1998/01/22 17:30:17 dyson Exp $ */ #include "opt_quota.h" @@ -849,6 +849,7 @@ ffs_sync(mp, waitfor, cred, p) struct fs *fs; struct timeval tv; int error, allerror = 0; + u_long fmask; fs = ump->um_fs; if (fs->fs_fmod != 0 && fs->fs_ronly != 0) { /* XXX */ @@ -858,6 +859,11 @@ ffs_sync(mp, waitfor, cred, p) /* * Write back each (modified) inode. */ + + fmask = (mp->mnt_flag & MNT_NOATIME)? + (IN_CHANGE | IN_MODIFIED | IN_UPDATE) : + (IN_CHANGE | IN_MODIFIED | IN_UPDATE | IN_ACCESS); + simple_lock(&mntvnode_slock); loop: for (vp = mp->mnt_vnodelist.lh_first; vp != NULL; vp = nvp) { @@ -870,8 +876,7 @@ loop: simple_lock(&vp->v_interlock); nvp = vp->v_mntvnodes.le_next; ip = VTOI(vp); - if (((ip->i_flag & - (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0) && + if (((ip->i_flag & fmask) == 0) && vp->v_dirtyblkhd.lh_first == NULL) { simple_unlock(&vp->v_interlock); continue; @@ -895,7 +900,6 @@ loop: simple_unlock(&mntvnode_slock); simple_unlock(&vp->v_interlock); gettime(&tv); - /* UFS_UPDATE(vp, &tv, &tv, waitfor == MNT_WAIT); */ UFS_UPDATE(vp, &tv, &tv, 0); simple_lock(&mntvnode_slock); } diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index d3b68b7..f89b8a3 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ffs_vnops.c 8.15 (Berkeley) 5/14/95 - * $Id: ffs_vnops.c,v 1.37 1997/10/27 13:33:45 bde Exp $ + * $Id: ffs_vnops.c,v 1.38 1998/01/06 05:23:44 dyson Exp $ */ #include <sys/param.h> @@ -105,6 +105,9 @@ SYSCTL_NODE(_vfs, MOUNT_UFS, ffs, CTLFLAG_RW, 0, "FFS filesystem"); #include <ufs/ufs/ufs_readwrite.c> +int ffs_log_sync = 0; + + /* * Synch an open file. */ @@ -126,7 +129,6 @@ ffs_fsync(ap) int s; daddr_t lbn; - if (vp->v_type == VBLK) { lbn = INT_MAX; } else { @@ -135,6 +137,12 @@ ffs_fsync(ap) lbn = lblkno(ip->i_fs, (ip->i_size + ip->i_fs->fs_bsize - 1)); } + if (ffs_log_sync) { + struct inode* ip = VTOI(vp); + printf("fsync i %u iflags 0x%x vn 0x%x vtype %d tag %d vflags 0x%x\n", + ip->i_number, ip->i_flag, vp, vp->v_type, vp->v_tag, vp->v_flag); + } + pass = 0; /* * Flush all dirty buffers associated with a vnode. @@ -148,6 +156,11 @@ loop: if ((bp->b_flags & B_DELWRI) == 0) panic("ffs_fsync: not dirty"); + if (ffs_log_sync) { + printf(" blk %u (%u) flags 0x%x vn 0x%x\n", bp->b_lblkno, bp->b_blkno, + bp->b_flags, bp->b_vp); + } + if (((bp->b_vp != vp) || (ap->a_waitfor != MNT_NOWAIT)) || ((vp->v_type != VREG) && (vp->v_type != VBLK))) { @@ -206,5 +219,5 @@ loop: } gettime(&tv); - return (UFS_UPDATE(ap->a_vp, &tv, &tv, ap->a_waitfor == MNT_WAIT)); + return (UFS_UPDATE(ap->a_vp, &tv, &tv, 1)); } |