mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
[PATCH] per-mountpoint noatime/nodiratime
Turn noatime and nodiratime into per-mount instead of per-sb flags. After all the preparations this is a rather trivial patch. The mount code needs to treat the two options as per-mount instead of per-superblock, and touch_atime needs to be changed to check the new MNT_ flags in addition to the MS_ flags that are kept for filesystems that are always noatime/nodiratime but not user settable anymore. Besides that core code only nfs needed an update because it's leaving atime updates to the server and thus sets the S_NOATIME flag on every inode, but needs to know whether it's a real noatime mount for an getattr optimization. While we're at it I've killed the IS_NOATIME/IS_NODIRATIME macros that were only used by touch_atime. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
0d456fa426
commit
fc33a7bb9c
6 changed files with 45 additions and 19 deletions
19
fs/inode.c
19
fs/inode.c
|
@ -22,6 +22,7 @@
|
|||
#include <linux/cdev.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/inotify.h>
|
||||
#include <linux/mount.h>
|
||||
|
||||
/*
|
||||
* This is needed for the following functions:
|
||||
|
@ -1189,14 +1190,22 @@ void touch_atime(struct vfsmount *mnt, struct dentry *dentry)
|
|||
struct inode *inode = dentry->d_inode;
|
||||
struct timespec now;
|
||||
|
||||
/* per-mountpoint checks will go here */
|
||||
if (IS_NOATIME(inode))
|
||||
return;
|
||||
if (IS_NODIRATIME(inode) && S_ISDIR(inode->i_mode))
|
||||
return;
|
||||
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)))
|
||||
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;
|
||||
|
||||
now = current_fs_time(inode->i_sb);
|
||||
if (!timespec_equal(&inode->i_atime, &now)) {
|
||||
inode->i_atime = now;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue