Return to BSD News archive
Newsgroups: comp.bugs.2bsd Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!news.ysu.edu!news.radio.cz!nntprelay.mathworks.com!news.maxwell.syr.edu!news.new-york.net!wlbr!moe.2bsd.com!sms From: sms@moe.2bsd.com (Steven M. Schultz) Subject: noaccesstime option added to mount(8) (#379) Organization: 2BSD, Simi Valley CA USA Message-ID: <ED1A2z.41y@moe.2bsd.com> Date: Wed, 9 Jul 1997 04:06:35 GMT Lines: 451 Xref: euryale.cc.adfa.oz.au comp.bugs.2bsd:816 Subject: noaccesstime option added to mount(8) (#379) Index: sys/sys_inode,ufs_mount,ufs_fio.c,sbin/mount/mount.c 2.11BSD Description: The noaccesstime option is missing from mount(8). This option allows the administrator to avoid updating the read access time on files. Repeat-By: mount -u -o noaccesstime /usr Observe the error. Fix: The ability to turn off the updating of read access times is not solely for transient/short-lived files. If one is running a find / -name '*.c' -print | xargs grep MNT_ why bother updating the read times on all the inodes of files which are grep'd? No one really pays attention to the read access time anyways. Turning off the read access time updating before running finds saves the kernel from having to do a lot of I/O which in turns saves time. The time savings are not dramatic but a few seconds here and there adds up. Question: How does a system get slow? Answer: One second at a time ;-) As an example, the command "find /usr -name '*.h' -print > /dev/null" Normal: 21.2u 134.7s 3:24 76% 3128+508io noaccesstime: 22.6u 130.3s 3:16 77% 3104+5io Not updating the accesstimes (and this is just on the directories, the .h files themselves are not being read) saved 500 writes to the disk (about 2.5 per second over the 200 second the test took). If /tmp is a separate filesystem it is a good idea to turn on 'noaccesstime' for it so that workfiles (such as 'ld' uses) don't get their times updated as they're read repeatedly. The following files are updated by the patch below: /usr/src/sys/sys/ufs_mount.c /usr/src/sys/sys/sys_inode.c /usr/src/sys/sys/ufs_fio.c /usr/src/sys/h/mount.h /usr/src/sbin/mount/mntopts.h /usr/src/sbin/mount/mount.c /usr/src/sbin/mount/mount.8 /VERSION To install this update cut where indicated, saving to a file (/tmp/379). Then: patch -p0 < /tmp/379 cd /usr/src/sbin/mount make make install make clean It is perfectly safe to install the new 'mount' command before booting a new kernel. Until a new kernel is installed the 'MNT_NOATIME' bit is masked off and ignored by the old kernel. Then a new kernel is compiled. If you have existing .o files from a previous compile this step will go quickly otherwise it will take about an hour: cd /sys/YOUR_KERNEL make cp -p /unix /ounix cp -p /netnix /onetnix make install The two 'cp' commands are optional but recommended. They save the current kernel for recovery purposes. In the unlikely event something is wrong with the newly compiled kernel you can boot the "/genunix" (emergency GENERIC kernel that everyone should keep around) and rename 'ounix' and 'onetnix' back to 'unix' and 'netnix' and then reboot with a networking kernel that works. IF you have a broken kernel by all means let me know about it. reboot You're all done. Enjoy. As always this and previous updates to 2.11BSD are available via anonymous FTP to either FTP.IIPO.GTEGSC.COM or MOE.2BSD.COM in the directory /pub/2.11BSD. ===============================cut here==================== *** /usr/src/sys/sys/ufs_mount.c.old Sat Jan 18 23:01:05 1997 --- /usr/src/sys/sys/ufs_mount.c Sun Jun 29 16:27:23 1997 *************** *** 3,9 **** * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)ufs_mount.c 2.0 (2.11BSD GTE) 1997/1/18 */ #include "param.h" --- 3,9 ---- * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)ufs_mount.c 2.1 (2.11BSD GTE) 1997/6/29 */ #include "param.h" *************** *** 96,102 **** fs->fs_ronly = 0; mp->m_flags &= ~MNT_RDONLY; } ! #define _MF (MNT_NOSUID | MNT_NODEV | MNT_NOEXEC | MNT_ASYNC | MNT_SYNCHRONOUS) mp->m_flags &= ~_MF; mp->m_flags |= (uap->flags & _MF); #undef _MF --- 96,102 ---- fs->fs_ronly = 0; mp->m_flags &= ~MNT_RDONLY; } ! #define _MF (MNT_NOSUID | MNT_NODEV | MNT_NOEXEC | MNT_ASYNC | MNT_SYNCHRONOUS | MNT_NOATIME) mp->m_flags &= ~_MF; mp->m_flags |= (uap->flags & _MF); #undef _MF *** /usr/src/sys/sys/sys_inode.c.old Tue Feb 4 20:01:28 1997 --- /usr/src/sys/sys/sys_inode.c Thu Jul 3 19:46:01 1997 *************** *** 3,9 **** * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)sys_inode.c 1.9 (2.11BSD GTE) 1997/1/30 */ #include "param.h" --- 3,9 ---- * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)sys_inode.c 1.10 (2.11BSD GTE) 1997/7/3 */ #include "param.h" *************** *** 126,132 **** * non-sync directory i/o - the sync bit is forced on. */ if (uio->uio_rw == UIO_READ) ! ip->i_flag |= IACC; else { switch (type) --- 126,135 ---- * non-sync directory i/o - the sync bit is forced on. */ if (uio->uio_rw == UIO_READ) ! { ! if (!(ip->i_fs->fs_flags & MNT_NOATIME)) ! ip->i_flag |= IACC; ! } else { switch (type) *************** *** 169,183 **** if (type == IFREG || type == IFDIR && (ip->i_fs->fs_flags & MNT_ASYNC)) ioflag &= ~IO_SYNC; ! if (type == IFCHR) { ! if (uio->uio_rw == UIO_READ) ! error = (*cdevsw[major(dev)].d_read)(dev, uio, ioflag); ! else { ! ip->i_flag |= IUPD|ICHG; ! error = (*cdevsw[major(dev)].d_write)(dev, uio, ioflag); ! } return (error); ! } if (uio->uio_resid == 0) return (0); if (uio->uio_rw == UIO_WRITE && type == IFREG && --- 172,192 ---- if (type == IFREG || type == IFDIR && (ip->i_fs->fs_flags & MNT_ASYNC)) ioflag &= ~IO_SYNC; ! if (type == IFCHR) ! { ! if (uio->uio_rw == UIO_READ) ! { ! if (!(ip->i_fs->fs_flags & MNT_NOATIME)) ! ip->i_flag |= IACC; ! error = (*cdevsw[major(dev)].d_read)(dev, uio, ioflag); ! } ! else ! { ! ip->i_flag |= IUPD|ICHG; ! error = (*cdevsw[major(dev)].d_write)(dev, uio, ioflag); ! } return (error); ! } if (uio->uio_resid == 0) return (0); if (uio->uio_rw == UIO_WRITE && type == IFREG && *** /usr/src/sys/sys/ufs_fio.c.old Mon Sep 16 21:09:30 1996 --- /usr/src/sys/sys/ufs_fio.c Thu Jul 3 19:47:42 1997 *************** *** 3,9 **** * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)ufs_fio.c 1.4 (2.11BSD GTE) 1996/9/13 */ #include "param.h" --- 3,9 ---- * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)ufs_fio.c 1.5 (2.11BSD GTE) 1997/7/3 */ #include "param.h" *************** *** 173,179 **** ((vap->va_vaflags & VA_UTIMES_NULL) == 0 || access(ip, IWRITE))) return(u.u_error); ! if (vap->va_atime != (time_t)VNOVAL) ip->i_flag |= IACC; if (vap->va_mtime != (time_t)VNOVAL) ip->i_flag |= (IUPD|ICHG); --- 173,180 ---- ((vap->va_vaflags & VA_UTIMES_NULL) == 0 || access(ip, IWRITE))) return(u.u_error); ! if (vap->va_atime != (time_t)VNOVAL && ! !(ip->i_fs->fs_flags & MNT_NOATIME)) ip->i_flag |= IACC; if (vap->va_mtime != (time_t)VNOVAL) ip->i_flag |= (IUPD|ICHG); *** /usr/src/sys/h/mount.h.old Thu Apr 18 21:26:40 1996 --- /usr/src/sys/h/mount.h Sun Jun 29 14:47:54 1997 *************** *** 3,9 **** * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)mount.h 7.2.4 (2.11BSD GTE) 1996/4/18 */ /* --- 3,9 ---- * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)mount.h 7.2.5 (2.11BSD GTE) 1997/6/29 */ /* *************** *** 78,83 **** --- 78,84 ---- #define MNT_NODEV 0x0010 /* don't interpret special files */ #define MNT_QUOTA 0x0020 /* quotas are enabled on filesystem */ #define MNT_ASYNC 0x0040 /* file system written asynchronously */ + #define MNT_NOATIME 0x0080 /* don't update access times */ /* * Mask of flags that are visible to statfs(). *** /usr/src/sbin/mount/mntopts.h.old Wed Feb 7 22:58:58 1996 --- /usr/src/sbin/mount/mntopts.h Sun Jun 29 15:22:10 1997 *************** *** 30,36 **** * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ! * @(#)mntopts.h 8.3.2 (2.11BSD) 1996/2/7 */ struct mntopt { --- 30,36 ---- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ! * @(#)mntopts.h 8.3.3 (2.11BSD) 1997/6/29 */ struct mntopt { *************** *** 41,46 **** --- 41,47 ---- /* User-visible MNT_ flags. */ #define MOPT_ASYNC { "async", 0, MNT_ASYNC } + #define MOPT_NOATIME { "accesstime", 1, MNT_NOATIME } #define MOPT_NODEV { "dev", 1, MNT_NODEV } #define MOPT_NOEXEC { "exec", 1, MNT_NOEXEC } #define MOPT_NOSUID { "suid", 1, MNT_NOSUID } *************** *** 58,77 **** #define MOPT_RQ { "rq", 1, MNT_RDONLY } /* Ignored options (used for control in fstab) */ ! #define MOPT_AUTO { "auto", } ! #define MOPT_NOAUTO { "na", } #define MOPT_FSTAB_COMPAT \ MOPT_RO, \ MOPT_RW, \ ! MOPT_RQ, \ ! MOPT_NOAUTO, \ ! MOPT_AUTO /* Standard options which all mounts can understand. */ #define MOPT_STDOPTS \ MOPT_FSTAB_COMPAT, \ MOPT_QUOTAS, \ MOPT_NODEV, \ MOPT_NOEXEC, \ MOPT_NOSUID, \ --- 59,78 ---- #define MOPT_RQ { "rq", 1, MNT_RDONLY } /* Ignored options (used for control in fstab) */ ! #define MOPT_NOAUTO { "na", }, \ ! { "auto", } #define MOPT_FSTAB_COMPAT \ MOPT_RO, \ MOPT_RW, \ ! MOPT_RQ /* Standard options which all mounts can understand. */ #define MOPT_STDOPTS \ MOPT_FSTAB_COMPAT, \ MOPT_QUOTAS, \ + MOPT_NOATIME, \ + MOPT_NOAUTO, \ MOPT_NODEV, \ MOPT_NOEXEC, \ MOPT_NOSUID, \ *** /usr/src/sbin/mount/mount.c.old Sat Nov 16 20:34:31 1996 --- /usr/src/sbin/mount/mount.c Sun Jun 29 16:02:05 1997 *************** *** 36,42 **** "@(#) Copyright (c) 1980, 1989, 1993, 1994\n\ The Regents of the University of California. All rights reserved.\n"; ! static char sccsid[] = "@(#)mount.c 8.19.3 (2.11BSD) 1996/11/16"; #endif /* not lint */ #include <sys/param.h> --- 36,42 ---- "@(#) Copyright (c) 1980, 1989, 1993, 1994\n\ The Regents of the University of California. All rights reserved.\n"; ! static char sccsid[] = "@(#)mount.c 8.19.4 (2.11BSD) 1997/6/29"; #endif /* not lint */ #include <sys/param.h> *************** *** 74,79 **** --- 74,80 ---- char *o_name; } optnames[] = { { MNT_ASYNC, "asynchronous" }, + { MNT_NOATIME, "noaccesstime" }, { MNT_NODEV, "nodev" }, { MNT_NOEXEC, "noexec" }, { MNT_NOSUID, "nosuid" }, *** /usr/src/sbin/mount/mount.8.old Sat Nov 16 20:34:12 1996 --- /usr/src/sbin/mount/mount.8 Thu Jul 3 20:15:04 1997 *************** *** 29,35 **** .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" ! .\" @(#)mount.8 8.7.3 (2.11BSD) 1996/11/16 .\" .TH MOUNT 8 "November 16, 1996" .UC 7 --- 29,35 ---- .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" ! .\" @(#)mount.8 8.7.3 (2.11BSD) 1997/7/3 .\" .TH MOUNT 8 "November 16, 1996" .UC 7 *************** *** 100,110 **** async All I/O to the file system should be done asynchronously. ! This is a ! .B dangerous ! flag to set, ! and should not be used unless you are prepared to recreate the file ! system should your system crash. .TP 10 force The same as --- 100,109 ---- async All I/O to the file system should be done asynchronously. ! ! .B This is a dangerous flag to set, ! .B and should not be used unless you are prepared to recreate the file ! .B system should your system crash. .TP 10 force The same as *************** *** 112,117 **** --- 111,128 ---- forces the revocation of write access when trying to downgrade a filesystem mount status from read-write to read-only. This is not (and likely never will be) supported in 2.11BSD. + .TP 10 + noaccesstime + File access times are not updated. + + .B This is a performance optimization for filesystems used for largely + .B read-only, short-lived data, e.g., news. + .TP 10 + noauto + This filesystem should be skipped when mount is run with the \fB\-a\fP flag. + .TP 10 + na + Same as noauto. .TP 10 nodev Do not interpret character or block special devices on the file system. *** /VERSION.old Sun Jul 6 20:31:24 1997 --- /VERSION Tue Jul 8 19:53:04 1997 *************** *** 1,5 **** ! Current Patch Level: 378 ! Date: July 6, 1997 2.11 BSD ============ --- 1,5 ---- ! Current Patch Level: 379 ! Date: July 8, 1997 2.11 BSD ============