summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1997-03-02 09:38:36 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1997-03-02 09:38:36 +0000
commit322646ef055f316e0cc138add35c58316a4de863 (patch)
treecd239d32c993f24e7ce5fbfdaa710c38faed1e41 /sys
parent68d0290aeb54cbe87344d09bcd43a705da6c5f31 (diff)
Add noatime option to not update atime on files in a filesystem (unless
ctime or mtime has changed). Useful for laptops and news servers.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/vfs_syscalls.c6
-rw-r--r--sys/sys/mount.h19
-rw-r--r--sys/ufs/ffs/ffs_inode.c5
-rw-r--r--sys/ufs/lfs/lfs_inode.c5
4 files changed, 21 insertions, 14 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index ebfa0276489..74d914ee7e8 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_syscalls.c,v 1.24 1997/02/26 16:38:20 niklas Exp $ */
+/* $OpenBSD: vfs_syscalls.c,v 1.25 1997/03/02 09:38:35 millert Exp $ */
/* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */
/*
@@ -251,9 +251,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 |= SCARG(uap, flags) & (MNT_NOSUID | MNT_NOEXEC |
- MNT_NODEV | MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC);
+ MNT_NODEV | MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_NOATIME);
/*
* Mount the filesystem.
*/
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
index 6a1d52a1023..85aa43e7286 100644
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mount.h,v 1.12 1996/12/24 20:14:35 dm Exp $ */
+/* $OpenBSD: mount.h,v 1.13 1997/03/02 09:38:22 millert Exp $ */
/* $NetBSD: mount.h,v 1.48 1996/02/18 11:55:47 fvdl Exp $ */
/*
@@ -133,22 +133,23 @@ 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 0x00000080 /* don't update atime on files */
/*
* exported mount flags.
*/
-#define MNT_EXRDONLY 0x00000080 /* exported read only */
-#define MNT_EXPORTED 0x00000100 /* file system is exported */
-#define MNT_DEFEXPORTED 0x00000200 /* exported to the world */
-#define MNT_EXPORTANON 0x00000400 /* use anon uid mapping for everyone */
-#define MNT_EXKERB 0x00000800 /* exported with Kerberos uid mapping */
+#define MNT_EXRDONLY 0x00000100 /* exported read only */
+#define MNT_EXPORTED 0x00000200 /* file system is exported */
+#define MNT_DEFEXPORTED 0x00000400 /* exported to the world */
+#define MNT_EXPORTANON 0x00000800 /* use anon uid mapping for everyone */
+#define MNT_EXKERB 0x00001000 /* exported with Kerberos uid mapping */
/*
* Flags set by internal operations.
*/
-#define MNT_LOCAL 0x00001000 /* filesystem is stored locally */
-#define MNT_QUOTA 0x00002000 /* quotas are enabled on filesystem */
-#define MNT_ROOTFS 0x00004000 /* identifies the root filesystem */
+#define MNT_LOCAL 0x00002000 /* filesystem is stored locally */
+#define MNT_QUOTA 0x00004000 /* quotas are enabled on filesystem */
+#define MNT_ROOTFS 0x00008000 /* identifies the root filesystem */
/*
* Mask of flags that are visible to statfs()
diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c
index 6c33e684cbc..1b1081e5ee2 100644
--- a/sys/ufs/ffs/ffs_inode.c
+++ b/sys/ufs/ffs/ffs_inode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_inode.c,v 1.4 1996/11/05 03:30:12 tholo Exp $ */
+/* $OpenBSD: ffs_inode.c,v 1.5 1997/03/02 09:38:13 millert Exp $ */
/* $NetBSD: ffs_inode.c,v 1.10 1996/05/11 18:27:19 mycroft Exp $ */
/*
@@ -96,6 +96,9 @@ ffs_update(v)
ip->i_flag &=
~(IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE);
return (0);
+ } else if ((ap->a_vp->v_mount->mnt_flag & MNT_NOATIME) &&
+ !(ip->i_flag & (IN_CHANGE | IN_UPDATE))) {
+ ip->i_flag &= ~IN_ACCESS;
}
if ((ip->i_flag &
(IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0)
diff --git a/sys/ufs/lfs/lfs_inode.c b/sys/ufs/lfs/lfs_inode.c
index b778b7db9fd..e8fd0be7baa 100644
--- a/sys/ufs/lfs/lfs_inode.c
+++ b/sys/ufs/lfs/lfs_inode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lfs_inode.c,v 1.4 1996/07/01 07:41:51 downsj Exp $ */
+/* $OpenBSD: lfs_inode.c,v 1.5 1997/03/02 09:38:18 millert Exp $ */
/* $NetBSD: lfs_inode.c,v 1.5 1996/05/11 18:27:35 mycroft Exp $ */
/*
@@ -90,6 +90,9 @@ lfs_update(v)
if (vp->v_mount->mnt_flag & MNT_RDONLY)
return (0);
ip = VTOI(vp);
+ if ((ap->a_vp->v_mount->mnt_flag & MNT_NOATIME) &&
+ !(ip->i_flag & (IN_CHANGE | IN_UPDATE)))
+ ip->i_flag &= ~IN_ACCESS;
if ((ip->i_flag &
(IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0)
return (0);