Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Jul 2002 10:20:55 -0700
From:      Alfred Perlstein <alfred@freebsd.org>
To:        fs@freebsd.org
Cc:        bde@freebsd.org, mckusick@freesd.org
Subject:   (forw) atime patch tested and fixed for 4.6 (fwd)
Message-ID:  <20020715172055.GM77219@elvis.mu.org>

next in thread | raw e-mail | index | archive | help
A friend whipped this patch up, what it does is update atime when
mtime/ctime change.  Is this ok?

----- Forwarded message from Nick Johnson <spatula@spatula.net> -----

From: Nick Johnson <spatula@spatula.net>
To: <alfred@freebsd.org>
Subject: atime patch tested and fixed for 4.6 (fwd)
Date: Mon, 15 Jul 2002 00:12:21 -0700 (PDT)
Message-ID: <Pine.BSF.4.30.0207150012100.37129-100000@yitiya.pair.com>


---------- Forwarded message ----------
Date: Mon, 8 Jul 2002 19:50:25 -0700 (PDT)
From: Nick Johnson <spatula@spatula.net>
To: alfred@freebsd.org
Subject: atime patch tested and fixed for 4.6

[turing] ~/atime> perl testpatch.pl
file created; atime=1026182996, mtime=1026182996, ctime=1026182996
file read; atime=1026182997, mtime=1026182996, ctime=1026182996
file append; atime=1026182998, mtime=1026182998, ctime=1026182998
[turing] ~/atime> su
Password:
turing# mount -o noatime -u /home
turing# exit
[turing] ~/atime> perl testpatch.pl
file created; atime=1026183032, mtime=1026183032, ctime=1026183032
file read; atime=1026183032, mtime=1026183032, ctime=1026183032
file append; atime=1026183034, mtime=1026183034, ctime=1026183034
[turing] ~/atime>

and here's the patch:

--- ufs_vnops.c.orig    Tue Feb  5 10:35:04 2002
+++ ufs_vnops.c Mon Jul  8 19:07:48 2002
@@ -159,6 +159,18 @@
                ip->i_flag |= IN_LAZYMOD;
        else
                ip->i_flag |= IN_MODIFIED;
+        /*
+         * If we're going to be updating or changing,
+         * it makes sense that we're accessing as well.
+         * This changes the traditional semantics of
+         * mount -o noatime slightly.
+         */
+        if (!(ip->i_flag & IN_ACCESS) &&
+             ((ip->i_flag & IN_UPDATE) ||
+              (ip->i_flag & IN_CHANGE))) {
+                ip->i_flag |= IN_ACCESS;
+        }
+
        if ((vp->v_mount->mnt_flag & MNT_RDONLY) == 0) {
                vfs_timestamp(&ts);
                if (ip->i_flag & IN_ACCESS) {


   Nick

-- 
"The aptly-named morons.org is an obscenity-laced screed..."
	-- Robert P. Lockwood, Catholic League director of research
Nick Johnson, version 2.0                     http://www.spatula.net/


----- End forwarded message -----

-- 
-Alfred Perlstein [alfred@freebsd.org]
'Instead of asking why a piece of software is using "1970s technology,"
 start asking why software is ignoring 30 years of accumulated wisdom.'
Tax deductible donations for FreeBSD: http://www.freebsdfoundation.org/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-fs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020715172055.GM77219>