summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sbin/mount/mntopts.h4
-rw-r--r--sbin/mount/mount.87
-rw-r--r--sbin/mount/mount.c5
-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
7 files changed, 33 insertions, 18 deletions
diff --git a/sbin/mount/mntopts.h b/sbin/mount/mntopts.h
index da6afa338c9..a49fa90894d 100644
--- a/sbin/mount/mntopts.h
+++ b/sbin/mount/mntopts.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mntopts.h,v 1.2 1996/06/23 14:31:11 deraadt Exp $ */
+/* $OpenBSD: mntopts.h,v 1.3 1997/03/02 09:38:30 millert Exp $ */
/* $NetBSD: mntopts.h,v 1.3 1995/03/18 14:56:59 cgd Exp $ */
/*-
@@ -44,6 +44,7 @@ struct mntopt {
/* User-visible MNT_ flags. */
#define MOPT_ASYNC { "async", 0, MNT_ASYNC }
+#define MOPT_NOATIME { "atime", 1, MNT_NOATIME }
#define MOPT_NODEV { "dev", 1, MNT_NODEV }
#define MOPT_NOEXEC { "exec", 1, MNT_NOEXEC }
#define MOPT_NOSUID { "suid", 1, MNT_NOSUID }
@@ -75,6 +76,7 @@ struct mntopt {
MOPT_USERQUOTA, \
MOPT_GROUPQUOTA, \
MOPT_FSTAB_COMPAT, \
+ MOPT_NOATIME, \
MOPT_NODEV, \
MOPT_NOEXEC, \
MOPT_NOSUID, \
diff --git a/sbin/mount/mount.8 b/sbin/mount/mount.8
index adf3a6e06c1..10dba75851e 100644
--- a/sbin/mount/mount.8
+++ b/sbin/mount/mount.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: mount.8,v 1.2 1996/06/23 14:31:11 deraadt Exp $
+.\" $OpenBSD: mount.8,v 1.3 1997/03/02 09:38:25 millert Exp $
.\" $NetBSD: mount.8,v 1.11 1995/07/12 06:23:21 cgd Exp $
.\"
.\" Copyright (c) 1980, 1989, 1991, 1993
@@ -129,6 +129,11 @@ The same as
.Fl f ;
forces the revocation of write access when trying to downgrade
a filesystem mount status from read-write to read-only.
+.It noatime
+Do not update atime on files in the system unless the mtime or ctime
+is being changed as well.
+This option is useful for laptops and news servers where one does
+not want the extra disk activity associated with updating the atime.
.It nodev
Do not interpret character or block special devices on the file system.
This option is useful for a server that has file systems containing
diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c
index 5f1465322fa..87ce9c4fbdf 100644
--- a/sbin/mount/mount.c
+++ b/sbin/mount/mount.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mount.c,v 1.13 1997/01/15 23:41:15 millert Exp $ */
+/* $OpenBSD: mount.c,v 1.14 1997/03/02 09:38:28 millert Exp $ */
/* $NetBSD: mount.c,v 1.24 1995/11/18 03:34:29 cgd Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)mount.c 8.19 (Berkeley) 4/19/94";
#else
-static char rcsid[] = "$OpenBSD: mount.c,v 1.13 1997/01/15 23:41:15 millert Exp $";
+static char rcsid[] = "$OpenBSD: mount.c,v 1.14 1997/03/02 09:38:28 millert Exp $";
#endif
#endif /* not lint */
@@ -93,6 +93,7 @@ static struct opt {
{ MNT_EXPORTANON, 1, "anon uid mapping" },
{ MNT_EXRDONLY, 1, "exported read-only" },
{ MNT_LOCAL, 0, "local" },
+ { MNT_NOATIME, 0, "noatime" },
{ MNT_NODEV, 0, "nodev" },
{ MNT_NOEXEC, 0, "noexec" },
{ MNT_NOSUID, 0, "nosuid" },
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);