Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Apr 2002 16:34:50 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Alfred Perlstein <alfred@FreeBSD.ORG>
Cc:        fs@FreeBSD.ORG, <mckusick@FreeBSD.ORG>
Subject:   Re: "notime fix" (forw) what do you think of this?
Message-ID:  <20020418161400.J13884-100000@gamplex.bde.org>
In-Reply-To: <20020417203119.GA90826@elvis.mu.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 17 Apr 2002, Alfred Perlstein wrote:

> it's a hack to make ufs_vnops update atime if it is going
> to update mtime or ctime.

This is just wrong.  atime is the time of last access.  POSIX says when
it is set.  POSIX doesn't seem to say explicity that it shall not be
set gratuitously, but POLA says that.

> ----- Forwarded message from Nick Johnson <spatula@spatula.net> -----
>
> From: Nick Johnson <spatula@spatula.net>
> To: al <bright@wintelcom.net>
> Subject: what do you think of this?
> Date: Wed, 17 Apr 2002 13:05:08 -0700 (PDT)
> Message-ID: <Pine.BSF.4.30.0204171304250.1596-100000@yitiya.pair.com>
>
> --- ufs_vnops.c.orig	Wed Apr 17 12:55:37 2002
> +++ ufs_vnops.c	Wed Apr 17 13:00:58 2002
> @@ -162,6 +162,17 @@
>  			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 (ip->i_flag & IN_ACCESS) {
>  			ip->i_atime = ts.tv_sec;
>  			ip->i_atimensec = ts.tv_nsec;

A better hack would be to be to not look at the noatime mount flag
when deciding to set IN_ACCESS elsewhere, and then write the atime
here if either noatime is not in effect or the inode must be written
to for other reasons.  It is probably best to discard IN_ACCESS here
if nothing needs to be written now, since keeping it until later (in
case the inode needs to be written later) would give wrong access times
later, and updating ip->i_atime* in core only would give incoherent
access times (they would go backwards if the inode is never written
and is restored from disk.

Bruce


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?20020418161400.J13884-100000>