Re: Relative atime (was Re: What's in ocfs2.git)

Eric Dumazet
2006-12-06T09:42:44Z

On Wednesday 06 December 2006 05:58, Andrew Morton wrote:
> > On Mon, 4 Dec 2006 16:36:20 -0800 Valerie Henson
> > <val_henson@linux.intel.com> wrote: Add "relatime" (relative atime)
> > support. Relative atime only updates the atime if the previous atime is
> > older than the mtime or ctime. Like noatime, but useful for applications
> > like mutt that need to know when a file has been read since it was last
> > modified.
>
> That seems like a good idea.
>
> I found touch_atime() to be rather putrid, so I hacked it around a bit.

I find this function full of tests...

> The end result:
>
> void touch_atime(struct vfsmount *mnt, struct dentry *dentry)
> {
> struct inode *inode = dentry->d_inode;
> struct timespec now;
>
> if (IS_RDONLY(inode))
> return;

While we are adding new tests, we could try to be smart here testing both
MS_RDONLY and MS_NOATIME.

if (__IS_FLG(inode, MS_RDONLY | MS_NOATIME))
return;

> if (inode->i_flags & S_NOATIME)
> return;

> if (inode->i_sb->s_flags & MS_NOATIME)
> return;
So that that one can be deleted.

>        if ((inode->i_sb->s_flags & MS_NODIRATIME) && S_ISDIR(inode->i_mode))
>                return;

if (__IS_FLG(inode, MS_NODIRATIME) && S_ISDIR(inode->i_mode))
return;

Eric