Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 44465
b: refs/heads/master
c: 47ae32d
h: refs/heads/master
i:
  44463: b9d4f21
v: v3
  • Loading branch information
Valerie Henson authored and Linus Torvalds committed Dec 13, 2006
1 parent 7b38054 commit d5d05fd
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b227613841d4d211a10c5860acc73e133b613bc0
refs/heads/master: 47ae32d6a54955a041cdc30b06d0bb16e75f68d5
22 changes: 18 additions & 4 deletions trunk/fs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1177,13 +1177,27 @@ void touch_atime(struct vfsmount *mnt, struct dentry *dentry)
return;
if ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode))
return;

if (mnt->mnt_flags & MNT_RELATIME) {
/*
* With relative atime, only update atime if the
* previous atime is earlier than either the ctime or
* mtime.
*/
if (timespec_compare(&inode->i_mtime,
&inode->i_atime) < 0 &&
timespec_compare(&inode->i_ctime,
&inode->i_atime) < 0)
return;
}
}

now = current_fs_time(inode->i_sb);
if (!timespec_equal(&inode->i_atime, &now)) {
inode->i_atime = now;
mark_inode_dirty_sync(inode);
}
if (timespec_equal(&inode->i_atime, &now))
return;

inode->i_atime = now;
mark_inode_dirty_sync(inode);
}
EXPORT_SYMBOL(touch_atime);

Expand Down
5 changes: 4 additions & 1 deletion trunk/fs/namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ static int show_vfsmnt(struct seq_file *m, void *v)
{ MNT_NOEXEC, ",noexec" },
{ MNT_NOATIME, ",noatime" },
{ MNT_NODIRATIME, ",nodiratime" },
{ MNT_RELATIME, ",relatime" },
{ 0, NULL }
};
struct proc_fs_info *fs_infop;
Expand Down Expand Up @@ -1405,9 +1406,11 @@ long do_mount(char *dev_name, char *dir_name, char *type_page,
mnt_flags |= MNT_NOATIME;
if (flags & MS_NODIRATIME)
mnt_flags |= MNT_NODIRATIME;
if (flags & MS_RELATIME)
mnt_flags |= MNT_RELATIME;

flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE |
MS_NOATIME | MS_NODIRATIME);
MS_NOATIME | MS_NODIRATIME | MS_RELATIME);

/* ... and get the mountpoint */
retval = path_lookup(dir_name, LOOKUP_FOLLOW, &nd);
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ extern int dir_notify_enable;
#define MS_PRIVATE (1<<18) /* change to private */
#define MS_SLAVE (1<<19) /* change to slave */
#define MS_SHARED (1<<20) /* change to shared */
#define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */
#define MS_ACTIVE (1<<30)
#define MS_NOUSER (1<<31)

Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/mount.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ struct mnt_namespace;
#define MNT_NOEXEC 0x04
#define MNT_NOATIME 0x08
#define MNT_NODIRATIME 0x10
#define MNT_RELATIME 0x20

#define MNT_SHRINKABLE 0x100

Expand Down

0 comments on commit d5d05fd

Please sign in to comment.