mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Cesar Eduardo Barros <cesarb@nitnet.com.br>
To: Christoph Hellwig <hch@infradead.org>,
	linux-kernel@vger.kernel.org, Alexander Viro <viro@math.psu.edu>
Subject: Re: [PATCH] O_NOATIME support
Date: Mon, 14 Jun 2004 10:46:52 -0300	[thread overview]
Message-ID: <20040614134652.GA1961@flower.home.cesarb.net> (raw)
In-Reply-To: <20040614095529.GA11563@infradead.org>

On Mon, Jun 14, 2004 at 10:55:29AM +0100, Christoph Hellwig wrote:
> On Fri, Jun 11, 2004 at 10:11:29PM -0300, Cesar Eduardo Barros wrote:
> > (not subscribed to lkml, please CC: me on replies)
> > 
> > This patch adds support for the O_NOATIME open flag (GNU extension):
> > 
> > int O_NOATIME  	Macro
> >   If this bit is set, read will not update the access time of the file.
> >   See File Times. This is used by programs that do backups, so that
> >   backing a file up does not count as reading it. Only the owner of the
> >   file or the superuser may use this bit.
> > 
> > It is useful if you want to do something with the file atime (for
> > instance, moving files that have not been accessed in a while to
> > somewhere else, or something like Debian's popularity-contest) but you
> > also want to read all files periodically (for instance, tripwire or
> > debsums).
> > 
> > Currently, the program that reads all files periodically has to use
> > utimes, which can race with the atime update:
> 
> Any chance we could change the flag to also not update mtime and ctime
> for updates on a fd opened with it (and renaming it to O_INVISIBLE for
> example).  That's needed for your above moving infrequently used files
> away scenario (aka a HSM)

I don't see why preserving the mtime and ctime would be necessary, since
to move a file away you either don't touch it (using rename) or only
read and unlink it (to write to a tape or other filesystem, and you can
save the atime and mtime while doing it). So O_NOATIME is enough for
both behaviours.

Besides, O_NOATIME is most important not for the program that's moving
the files elsewhere, but for these checksum-the-world utilities that
read every single file they can see, and in the process manage to
destroy the usefulness of the atime, or backup programs that also read
everything they can touch. Both currently have to use utimes after
reading the whole file to restore the atime it had when they began
reading, which can take a long time if the file is huge (but note that
the mtime doesn't change since they are all reading, not writing).

The ctime changing is not a problem, since programs that want to move
infrequently used files away will use only the atime and mtime to make
their decisions, not the ctime. Also, wouldn't not changing the atime
make the ctime not change too, since nothing in the inode has changed?

O_NOATIME would also be useful for things like tar --atime-preserve,
cpio --reset-access-time, star -atime, pax -t, and others.

-- 
Cesar Eduardo Barros
cesarb@nitnet.com.br
cesarb@dcc.ufrj.br

  reply	other threads:[~2004-06-14 14:11 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-12  1:11 Cesar Eduardo Barros
2004-06-12 16:44 ` Bernd Eckenfels
2004-06-12 18:09   ` Chris Wedgwood
2004-06-12 18:22     ` Bernd Eckenfels
2004-06-14  9:55 ` Christoph Hellwig
2004-06-14 13:46   ` Cesar Eduardo Barros [this message]
2004-06-14 14:03     ` Christoph Hellwig
2004-06-14 19:25       ` Cesar Eduardo Barros
2004-06-14 16:57     ` David Lang
2004-06-14 19:34       ` Cesar Eduardo Barros
2004-06-14 15:38   ` Paul Jackson
2004-06-14 21:12 ` Alexandre Oliva
2004-06-14 21:58   ` Valdis.Kletnieks
2004-06-14 22:09   ` Matthias Schniedermeyer
2004-06-15 19:02     ` Alexandre Oliva
2004-06-16  1:49       ` Horst von Brand
2004-06-14 22:40   ` Cesar Eduardo Barros
2004-06-14 23:14     ` Bernd Eckenfels
2004-06-15 19:01     ` Alexandre Oliva
2004-06-15 19:32       ` Matthias Schniedermeyer
2004-06-15 22:03         ` Paul Jackson
2004-06-16  6:21           ` Matthias Schniedermeyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040614134652.GA1961@flower.home.cesarb.net \
    --to=cesarb@nitnet.com.br \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@math.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®