X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=fs%2Finode.c;h=bf21dc6d0dbd752d243a2d3b6d92d2d554dc0381;hb=74bda9310fe9776f3d940057ac2e7881214577d6;hp=9ecccab7326db2e032d52a0c4e3865a30c6354ee;hpb=0a01707b289853f56d1c000057b27e243c039722;p=powerpc.git diff --git a/fs/inode.c b/fs/inode.c index 9ecccab732..bf21dc6d0d 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -1144,7 +1144,6 @@ sector_t bmap(struct inode * inode, sector_t block) res = inode->i_mapping->a_ops->bmap(inode->i_mapping, block); return res; } - EXPORT_SYMBOL(bmap); /** @@ -1163,27 +1162,43 @@ void touch_atime(struct vfsmount *mnt, struct dentry *dentry) if (IS_RDONLY(inode)) return; - - if ((inode->i_flags & S_NOATIME) || - (inode->i_sb->s_flags & MS_NOATIME) || - ((inode->i_sb->s_flags & MS_NODIRATIME) && S_ISDIR(inode->i_mode))) + if (inode->i_flags & S_NOATIME) + return; + if (inode->i_sb->s_flags & MS_NOATIME) + return; + if ((inode->i_sb->s_flags & MS_NODIRATIME) && S_ISDIR(inode->i_mode)) return; /* * We may have a NULL vfsmount when coming from NFSD */ - if (mnt && - ((mnt->mnt_flags & MNT_NOATIME) || - ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode)))) - return; + if (mnt) { + if (mnt->mnt_flags & MNT_NOATIME) + return; + if ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode)) + 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 (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)) + return; + + inode->i_atime = now; + mark_inode_dirty_sync(inode); +} EXPORT_SYMBOL(touch_atime); /** @@ -1200,7 +1215,7 @@ EXPORT_SYMBOL(touch_atime); void file_update_time(struct file *file) { - struct inode *inode = file->f_dentry->d_inode; + struct inode *inode = file->f_path.dentry->d_inode; struct timespec now; int sync_it = 0;