per-mount noatime and nodiratime
Subsystems (2)
PATCH 6/6 per-mount noatime and nodiratime
Turn noatime and nodiratime into per-mount instead of per-sb flags.
After all the preparations this is a rather trivial patch, touch_atime and nfs need to be changed to check the new location (and I've killed the IS_NOATIME/IS_NODIRATIME macros that were only used by touch_atime while we were at it), and the mount/remount code needed small changes to treat it correctly.
fs/inode.c +6 -5
@@ -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,14 @@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 ) || + (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;
fs/namespace.c +9 -3
@@ -355,14 +355,14 @@ { MS_SYNCHRONOUS, ",sync" }, { MS_DIRSYNC, ",dirsync" }, { MS_MANDLOCK, ",mand" }, - { MS_NOATIME, ",noatime" }, - { MS_NODIRATIME, ",nodiratime" }, { 0, NULL } };static struct proc_fs_info mnt_info[] = { {MNT_NOSUID ,",nosuid" }, {MNT_NODEV ,",nodev" }, {MNT_NOEXEC ,",noexec" }, + {MNT_NOATIME ,",noatime" }, + {MNT_NODIRATIME ,",nodiratime" }, {0 ,NULL } };struct proc_fs_info *fs_infop;
@@ -1286,7 +1286,13 @@ mnt_flags |=MNT_NODEV ;if (flags &MS_NOEXEC ) mnt_flags |=MNT_NOEXEC ; - flags &= ~(MS_NOSUID |MS_NOEXEC |MS_NODEV |MS_ACTIVE ); +if (flags &MS_NOATIME ) + mnt_flags |=MNT_NOATIME ; +if (flags &MS_NODIRATIME ) + mnt_flags |=MNT_NODIRATIME ; + + flags &= ~(MS_NOSUID |MS_NOEXEC |MS_NODEV |MS_ACTIVE | +MS_NOATIME |MS_NODIRATIME );/* ... and get the mountpoint */ retval =path_lookup (dir_name,LOOKUP_FOLLOW , &nd);
fs/nfs/inode.c +3 -3
@@ -936,10 +936,10 @@int need_atime =NFS_I (inode)->cache_validity &NFS_INO_INVALID_ATIME ;int err; -if (__IS_FLG (inode,MS_NOATIME )) - need_atime =0 ; -else if (__IS_FLG (inode,MS_NODIRATIME ) &&S_ISDIR (inode->i_mode)) +if ((mnt->mnt_flags &MNT_NOATIME ) || + ((mnt->mnt_flags &MNT_NODIRATIME ) &&S_ISDIR (inode->i_mode))) need_atime =0 ; +/* We may force a getattr if the user cares about atime */ if (need_atime) err =__nfs_revalidate_inode (NFS_SERVER (inode), inode);
fs/super.c +2 -2
@@ -830,9 +830,9 @@ mnt->mnt_parent = mnt;if (type->fs_flags &FS_NOATIME ) - sb->s_flags |=MS_NOATIME ; + mnt->mnt_flags |=MNT_NOATIME ;if (type->fs_flags &FS_NODIRATIME ) - sb->s_flags |=MS_NODIRATIME ; + mnt->mnt_flags |=MNT_NODIRATIME ;up_write (&sb->s_umount);free_secdata (secdata);
include/linux/fs.h +1 -4
@@ -116,8 +116,7 @@/* * Superblock flags that can be altered by MS_REMOUNT */ -#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_NOATIME|\ - MS_NODIRATIME) +#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK)/* * Old magic mount flag and mask
@@ -163,8 +162,6 @@#define IS_NOQUOTA (inode) ((inode)->i_flags & S_NOQUOTA)#define IS_APPEND (inode) ((inode)->i_flags & S_APPEND)#define IS_IMMUTABLE (inode) ((inode)->i_flags & S_IMMUTABLE) -#define IS_NOATIME (inode) (__IS_FLG(inode, MS_NOATIME) || ((inode)->i_flags & S_NOATIME)) -#define IS_NODIRATIME (inode) __IS_FLG(inode, MS_NODIRATIME)#define IS_POSIXACL (inode) __IS_FLG(inode, MS_POSIXACL)#define IS_DEADDIR (inode) ((inode)->i_flags & S_DEAD)
include/linux/mount.h +5 -2
@@ -20,8 +20,11 @@#define MNT_NOSUID 0x01#define MNT_NODEV 0x02#define MNT_NOEXEC 0x04 -#define MNT_SHARED 0x10/* if the vfsmount is a shared mount */ -#define MNT_UNBINDABLE 0x20/* if the vfsmount is a unbindable mount */ +#define MNT_NOATIME 0x08 +#define MNT_NODIRATIME 0x10 + +#define MNT_SHARED 0x1000/* if the vfsmount is a shared mount */ +#define MNT_UNBINDABLE 0x2000/* if the vfsmount is a unbindable mount */ #define MNT_PNODE_MASK (MNT_SHARED | MNT_UNBINDABLE)
Quoted 9 lines · Christoph Hellwig
Turn noatime and nodiratime into per-mount instead of per-sb flags.
After all the preparations this is a rather trivial patch,
touch_atimeand nfs need to be changed to check the new location (and I've killed the IS_NOATIME/IS_NODIRATIME macros that were only used bytouch_atimewhile we were at it), and the mount/remount code needed small changes to treat it correctly.
Where'd this hunk come from?
Quoted 6 lines
Index:
linux-2.6.15-rc5/fs/super.c
===================================================================fs/super.c +0
-0@@ -830,9 +830,9 @@ mnt->mnt_parent = mnt;
fs/super.c line 838
Quoted 10 lines
fs/super.c +2
-2if (type->fs_flags &FS_NOATIME ) - sb->s_flags |=MS_NOATIME ; + mnt->mnt_flags |=MNT_NOATIME ;if (type->fs_flags &FS_NODIRATIME ) - sb->s_flags |=MS_NODIRATIME ; + mnt->mnt_flags |=MNT_NODIRATIME ;up_write (&sb->s_umount);free_secdata (secdata);
I just dropped it, but it's a worry...
Quoted 16 lines · Andrew Morton
Where'd this hunk come from?
Quoted 14 lines
Index:
linux-2.6.15-rc5/fs/super.c
===================================================================fs/super.c +2
-2@@ -830,9 +830,9 @@ mnt->mnt_parent = mnt;if (type->fs_flags &FS_NOATIME ) - sb->s_flags |=MS_NOATIME ; + mnt->mnt_flags |=MNT_NOATIME ;if (type->fs_flags &FS_NODIRATIME ) - sb->s_flags |=MS_NODIRATIME ; + mnt->mnt_flags |=MNT_NODIRATIME ;
Quoted 4 lines
fs/super.c line 838
Quoted 2 lines
fs/super.c +0
-0up_write (&sb->s_umount);free_secdata (secdata);I just dropped it, but it's a worry...
This is totally intentional. The FS_* flags were introduced in the previous patch to mark filesystems that always are NOATIME/NODIRATIME, and with this patch we need to set them in the vfsmount instead of the superblock.
Quoted 18 lines · Christoph Hellwig
Quoted 16 lines · Andrew Morton
Where'd this hunk come from?
Quoted 14 lines
Index:
linux-2.6.15-rc5/fs/super.c
===================================================================fs/super.c +2
-2@@ -830,9 +830,9 @@ mnt->mnt_parent = mnt;if (type->fs_flags &FS_NOATIME ) - sb->s_flags |=MS_NOATIME ; + mnt->mnt_flags |=MNT_NOATIME ;if (type->fs_flags &FS_NODIRATIME ) - sb->s_flags |=MS_NODIRATIME ; + mnt->mnt_flags |=MNT_NODIRATIME ;
Quoted 7 lines
Quoted 4 lines
fs/super.c line 838
Quoted 2 lines
fs/super.c +0
-0up_write (&sb->s_umount);free_secdata (secdata);I just dropped it, but it's a worry...
This is totally intentional. The FS_* flags were introduced in the previous patch to mark filesystems that always are NOATIME/NODIRATIME,
Please refer to patches by their filename or Subject:. I assume you're referring to "[PATCH 3/6] introduce FS_NOATIME and FS_NODIRATIME flags"?
If so, that patch doesn't touch fs/super.c. Please fix and resend.