From 9e04304259fd3db4a5cb2b1530e2f96355d215b8 Mon Sep 17 00:00:00 2001 From: David Greenman Date: Tue, 3 Sep 1996 07:09:11 +0000 Subject: [PATCH] Implemented kernel side of MNT_NOATIME mount option. This option disables the file access time update on reads and can be useful in reducing filesystem overhead in cases where the access time is not important (like Usenet news spools). --- sys/kern/vfs_extattr.c | 6 +++--- sys/kern/vfs_syscalls.c | 6 +++--- sys/sys/mount.h | 16 +++++++++++----- sys/ufs/ufs/ufs_readwrite.c | 5 +++-- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c index 95e9de03dfe..3870776201f 100644 --- a/sys/kern/vfs_extattr.c +++ b/sys/kern/vfs_extattr.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 - * $Id: vfs_syscalls.c,v 1.47 1996/05/11 04:39:53 bde Exp $ + * $Id: vfs_syscalls.c,v 1.48 1996/05/24 16:19:23 peter Exp $ */ /* @@ -182,9 +182,9 @@ update: else if (mp->mnt_flag & MNT_RDONLY) mp->mnt_flag |= MNT_WANTRDWR; mp->mnt_flag &=~ (MNT_NOSUID | MNT_NOEXEC | MNT_NODEV | - MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC); + MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_NOATIME); mp->mnt_flag |= uap->flags & (MNT_NOSUID | MNT_NOEXEC | MNT_NODEV | - MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_FORCE); + MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_FORCE | MNT_NOATIME); /* * Mount the filesystem. */ diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 95e9de03dfe..3870776201f 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 - * $Id: vfs_syscalls.c,v 1.47 1996/05/11 04:39:53 bde Exp $ + * $Id: vfs_syscalls.c,v 1.48 1996/05/24 16:19:23 peter Exp $ */ /* @@ -182,9 +182,9 @@ update: else if (mp->mnt_flag & MNT_RDONLY) mp->mnt_flag |= MNT_WANTRDWR; mp->mnt_flag &=~ (MNT_NOSUID | MNT_NOEXEC | MNT_NODEV | - MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC); + MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_NOATIME); mp->mnt_flag |= uap->flags & (MNT_NOSUID | MNT_NOEXEC | MNT_NODEV | - MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_FORCE); + MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_FORCE | MNT_NOATIME); /* * Mount the filesystem. */ diff --git a/sys/sys/mount.h b/sys/sys/mount.h index e6bad82c15f..d044d29b268 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)mount.h 8.13 (Berkeley) 3/27/94 - * $Id: mount.h,v 1.30 1995/12/22 16:02:39 phk Exp $ + * $Id: mount.h,v 1.31 1996/01/30 23:00:54 mpp Exp $ */ #ifndef _SYS_MOUNT_H_ @@ -63,8 +63,7 @@ struct fid { #define MNAMELEN 90 /* length of buffer for returned name */ struct statfs { - short f_type; /* type of filesystem (see below) */ - short f_flags; /* copy of mount flags */ + long f_spare2; /* placeholder */ long f_bsize; /* fundamental file system block size */ long f_iosize; /* optimal transfer block size */ long f_blocks; /* total data blocks in file system */ @@ -73,7 +72,10 @@ struct statfs { long f_files; /* total file nodes in file system */ long f_ffree; /* free file nodes in fs */ fsid_t f_fsid; /* file system id */ - long f_spare[9]; /* spare for later */ + uid_t f_owner; /* user that mounted the filesystem */ + int f_type; /* type of filesystem (see below) */ + int f_flags; /* copy of mount flags */ + long f_spare[6]; /* spare for later */ char f_mntonname[MNAMELEN]; /* directory on which mounted */ char f_mntfromname[MNAMELEN];/* mounted filesystem */ }; @@ -156,6 +158,7 @@ struct mount { #define MNT_NODEV 0x00000010 /* don't interpret special files */ #define MNT_UNION 0x00000020 /* union with underlying filesystem */ #define MNT_ASYNC 0x00000040 /* file system written asynchronously */ +#define MNT_NOATIME 0x10000000 /* Disable update of file access times */ /* * exported mount flags. @@ -177,7 +180,10 @@ struct mount { /* * Mask of flags that are visible to statfs() */ -#define MNT_VISFLAGMASK 0x0000ffff +#define MNT_VISFLAGMASK (MNT_RDONLY|MNT_SYNCHRONOUS|MNT_NOEXEC|MNT_NOSUID| \ + MNT_NODEV|MNT_UNION|MNT_ASYNC|MNT_EXRDONLY|MNT_EXPORTED| \ + MNT_DEFEXPORTED|MNT_EXPORTANON|MNT_EXKERB|MNT_LOCAL| \ + MNT_QUOTA|MNT_ROOTFS|MNT_USER|MNT_NOATIME) /* * filesystem control flags. diff --git a/sys/ufs/ufs/ufs_readwrite.c b/sys/ufs/ufs/ufs_readwrite.c index ff2c5401572..415e7c6a70e 100644 --- a/sys/ufs/ufs/ufs_readwrite.c +++ b/sys/ufs/ufs/ufs_readwrite.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ufs_readwrite.c 8.7 (Berkeley) 1/21/94 - * $Id: ufs_readwrite.c,v 1.20 1996/01/19 03:59:26 dyson Exp $ + * $Id: ufs_readwrite.c,v 1.21 1996/06/25 03:00:44 davidg Exp $ */ #ifdef LFS_READWRITE @@ -163,7 +163,8 @@ READ(ap) } if (bp != NULL) bqrelse(bp); - ip->i_flag |= IN_ACCESS; + if (!(vp->v_mount->mnt_flag & MNT_NOATIME)) + ip->i_flag |= IN_ACCESS; return (error); }