All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 6/6] per-mount noatime and nodiratime
@ 2005-12-13 17:56 Christoph Hellwig
  2005-12-13 22:36 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2005-12-13 17:56 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel

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.


Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6.15-rc5/fs/inode.c
===================================================================
--- linux-2.6.15-rc5.orig/fs/inode.c	2005-12-12 18:51:16.000000000 +0100
+++ linux-2.6.15-rc5/fs/inode.c	2005-12-13 12:13:30.000000000 +0100
@@ -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;
Index: linux-2.6.15-rc5/fs/namespace.c
===================================================================
--- linux-2.6.15-rc5.orig/fs/namespace.c	2005-12-12 18:51:16.000000000 +0100
+++ linux-2.6.15-rc5/fs/namespace.c	2005-12-13 12:01:01.000000000 +0100
@@ -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);
Index: linux-2.6.15-rc5/fs/nfs/inode.c
===================================================================
--- linux-2.6.15-rc5.orig/fs/nfs/inode.c	2005-12-13 11:00:57.000000000 +0100
+++ linux-2.6.15-rc5/fs/nfs/inode.c	2005-12-13 11:50:51.000000000 +0100
@@ -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);
Index: linux-2.6.15-rc5/fs/super.c
===================================================================
--- linux-2.6.15-rc5.orig/fs/super.c	2005-12-13 11:27:14.000000000 +0100
+++ linux-2.6.15-rc5/fs/super.c	2005-12-13 12:06:00.000000000 +0100
@@ -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);
Index: linux-2.6.15-rc5/include/linux/fs.h
===================================================================
--- linux-2.6.15-rc5.orig/include/linux/fs.h	2005-12-13 11:12:05.000000000 +0100
+++ linux-2.6.15-rc5/include/linux/fs.h	2005-12-13 12:05:24.000000000 +0100
@@ -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)
Index: linux-2.6.15-rc5/include/linux/mount.h
===================================================================
--- linux-2.6.15-rc5.orig/include/linux/mount.h	2005-12-12 18:51:18.000000000 +0100
+++ linux-2.6.15-rc5/include/linux/mount.h	2005-12-13 11:57:49.000000000 +0100
@@ -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)
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 6/6] per-mount noatime and nodiratime
  2005-12-13 17:56 [PATCH 6/6] per-mount noatime and nodiratime Christoph Hellwig
@ 2005-12-13 22:36 ` Andrew Morton
  2005-12-13 22:39   ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2005-12-13 22:36 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-kernel

Christoph Hellwig <hch@lst.de> wrote:
>
> 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.
> 

Where'd this hunk come from?

> Index: linux-2.6.15-rc5/fs/super.c
> ===================================================================
> --- linux-2.6.15-rc5.orig/fs/super.c	2005-12-13 11:27:14.000000000 +0100
> +++ linux-2.6.15-rc5/fs/super.c	2005-12-13 12:06:00.000000000 +0100
> @@ -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);

I just dropped it, but it's a worry...

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 6/6] per-mount noatime and nodiratime
  2005-12-13 22:36 ` Andrew Morton
@ 2005-12-13 22:39   ` Christoph Hellwig
  2005-12-13 23:21     ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2005-12-13 22:39 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Christoph Hellwig, linux-kernel

On Tue, Dec 13, 2005 at 02:36:38PM -0800, Andrew Morton wrote:
> Where'd this hunk come from?
> 
> > Index: linux-2.6.15-rc5/fs/super.c
> > ===================================================================
> > --- linux-2.6.15-rc5.orig/fs/super.c	2005-12-13 11:27:14.000000000 +0100
> > +++ linux-2.6.15-rc5/fs/super.c	2005-12-13 12:06:00.000000000 +0100
> > @@ -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);
> 
> 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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 6/6] per-mount noatime and nodiratime
  2005-12-13 22:39   ` Christoph Hellwig
@ 2005-12-13 23:21     ` Andrew Morton
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2005-12-13 23:21 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: hch, linux-kernel

Christoph Hellwig <hch@lst.de> wrote:
>
> On Tue, Dec 13, 2005 at 02:36:38PM -0800, Andrew Morton wrote:
> > Where'd this hunk come from?
> > 
> > > Index: linux-2.6.15-rc5/fs/super.c
> > > ===================================================================
> > > --- linux-2.6.15-rc5.orig/fs/super.c	2005-12-13 11:27:14.000000000 +0100
> > > +++ linux-2.6.15-rc5/fs/super.c	2005-12-13 12:06:00.000000000 +0100
> > > @@ -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);
> > 
> > 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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-12-13 23:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-13 17:56 [PATCH 6/6] per-mount noatime and nodiratime Christoph Hellwig
2005-12-13 22:36 ` Andrew Morton
2005-12-13 22:39   ` Christoph Hellwig
2005-12-13 23:21     ` Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.