]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/inode.c
Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband
[linux-2.6-omap-h63xx.git] / fs / inode.c
index 04536ebc5ac46c8012408168a87083fa442c3039..bf21dc6d0dbd752d243a2d3b6d92d2d554dc0381 100644 (file)
@@ -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);