Lazy atime - update the atime in the in-core inode, but don't mark the inode dirty. Atime only gets written out when the inode is dirtied for some other reason. Not for inclusion! Written by Val Henson fs/inode.c | 4 +++- fs/namespace.c | 5 ++++- include/linux/fs.h | 1 + include/linux/mount.h | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff -Nru a/fs/inode.c b/fs/inode.c --- a/fs/inode.c 2006-08-02 20:53:45 -07:00 +++ b/fs/inode.c 2006-08-02 20:53:45 -07:00 @@ -1202,7 +1202,9 @@ now = current_fs_time(inode->i_sb); if (!timespec_equal(&inode->i_atime, &now)) { inode->i_atime = now; - mark_inode_dirty_sync(inode); + /* Don't mark inode dirty if we are lazy about atime */ + if (!(mnt && (mnt->mnt_flags & MNT_LAZYATIME))) + mark_inode_dirty_sync(inode); } } diff -Nru a/fs/namespace.c b/fs/namespace.c --- a/fs/namespace.c 2006-08-02 20:53:45 -07:00 +++ b/fs/namespace.c 2006-08-02 20:53:45 -07:00 @@ -376,6 +376,7 @@ { MNT_NOEXEC, ",noexec" }, { MNT_NOATIME, ",noatime" }, { MNT_NODIRATIME, ",nodiratime" }, + { MNT_LAZYATIME, ",lazyatime" }, { 0, NULL } }; struct proc_fs_info *fs_infop; @@ -1413,9 +1414,11 @@ mnt_flags |= MNT_NOATIME; if (flags & MS_NODIRATIME) mnt_flags |= MNT_NODIRATIME; + if (flags & MS_LAZYATIME) + mnt_flags |= MNT_LAZYATIME; flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE | - MS_NOATIME | MS_NODIRATIME); + MS_NOATIME | MS_NODIRATIME | MS_LAZYATIME); /* ... and get the mountpoint */ retval = path_lookup(dir_name, LOOKUP_FOLLOW, &nd); diff -Nru a/include/linux/fs.h b/include/linux/fs.h --- a/include/linux/fs.h 2006-08-02 20:53:45 -07:00 +++ b/include/linux/fs.h 2006-08-02 20:53:45 -07:00 @@ -119,6 +119,7 @@ #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_LAZYATIME (1<<21) /* Lazily update on-disk access times. */ #define MS_ACTIVE (1<<30) #define MS_NOUSER (1<<31) diff -Nru a/include/linux/mount.h b/include/linux/mount.h --- a/include/linux/mount.h 2006-08-02 20:53:45 -07:00 +++ b/include/linux/mount.h 2006-08-02 20:53:45 -07:00 @@ -27,6 +27,7 @@ #define MNT_NOEXEC 0x04 #define MNT_NOATIME 0x08 #define MNT_NODIRATIME 0x10 +#define MNT_LAZYATIME 0x20 #define MNT_SHRINKABLE 0x100