LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* What's in ocfs2.git
@ 2006-12-03 20:31 Mark Fasheh
  2006-12-04 10:54 ` Steven Whitehouse
  0 siblings, 1 reply; 13+ messages in thread
From: Mark Fasheh @ 2006-12-03 20:31 UTC (permalink / raw)
  To: linux-kernel, ocfs2-devel

This e-mail describes the OCFS2 patches which I intend to push
upstream to Linus for 2.6.20.

* Various ocfs2 cleanups, including a patchset by me intended to clean up
  some of the internal ocfs2 journal api. Mostly this revolves around
  removing the ocfs2_journal_handle wrapper around handle_t. The immediate
  benefits are better readability and a slightly smaller memory footprint
  for open journal transactions.


* Configfs gets some small cleanups and some mutex annotations.


* Atime updates - thanks to Tiger Yang <tiger.yang@oracle.com>, ocfs2 now
  writes to the inode atime field. This doesn't require any disk changes,
  and is completely backwards compatible with older ocfs2 versions. An
  inodes Atime is only updated if it hasn't changed within a certain
  quantum. The user can define their own value at mount time, with 0
  indicating that atime should always be updated. This is very similar to
  the scheme implemented by gfs2. In the future, I'd like to see a "relative
  atime" mode, which functions in the manner described by Valerie Henson at:

http://lkml.org/lkml/2006/8/25/380


* sys_splice - ocfs2 now has splice read and write support. Thanks again to
  Tiger for the bulk of this functionality. Mostly we make use of the
  generic_splice_read() and generic_file_splice_write_nolock() functions
  provided already in fs/splice.c.

 - There is one patch in the ocfs2 splice() series external to fs/ocfs2 - a
   simple export of should_remove_suid(). This is done for code reuse
   purposes. That particular patch can be seen at:

http://ftp.kernel.org/pub/linux/kernel/people/mfasheh/ocfs2/ocfs2_git_patches/ocfs2-upstream-linus-20061201/0025-Export-should_remove_suid.txt

   I'll also attach it to this mail for review purposes.


* Last in the list of notable patches is a somewhat involved fix by Kurt
  Hackel <kurt.hackel@oracle.com> within the ocfs2 dlm. We had temporarily
  disable automatic migration of certain lock types because it was causing
  us problems during stress testing. This patch fixes those problems and
  re-enables migration. Overall this should reduce memory usage of the ocfs2
  dlm.


The patches can be found in

git://git.kernel.org/pub/scm/linux/kernel/git/mfasheh/ocfs2.git upstream-linus

Additionally, broken out patches are available at:

http://ftp.kernel.org/pub/linux/kernel/people/mfasheh/ocfs2/ocfs2_git_patches/ocfs2-upstream-linus-20060924/

Thanks,
	--Mark

--
Mark Fasheh
Senior Software Developer, Oracle
mark.fasheh@oracle.com


[PATCH] Export should_remove_suid()

This helps us avoid replicating the same logic within file system drivers.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>

---

 mm/filemap.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

d23a147bb6e8d467e8df73b6589888717da3b9ce
diff --git a/mm/filemap.c b/mm/filemap.c
index 7b84dc8..13df01c 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1893,6 +1893,7 @@ int should_remove_suid(struct dentry *de
 
 	return 0;
 }
+EXPORT_SYMBOL(should_remove_suid);
 
 int __remove_suid(struct dentry *dentry, int kill)
 {
-- 
1.3.3


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

* Re: What's in ocfs2.git
  2006-12-03 20:31 What's in ocfs2.git Mark Fasheh
@ 2006-12-04 10:54 ` Steven Whitehouse
  2006-12-05  0:10   ` Mark Fasheh
  0 siblings, 1 reply; 13+ messages in thread
From: Steven Whitehouse @ 2006-12-04 10:54 UTC (permalink / raw)
  To: Valerie Henson, Mark Fasheh; +Cc: linux-kernel, ocfs2-devel

Hi,

On Sun, 2006-12-03 at 12:31 -0800, Mark Fasheh wrote:
> This e-mail describes the OCFS2 patches which I intend to push
> upstream to Linus for 2.6.20.
> 
> * Atime updates - thanks to Tiger Yang <tiger.yang@oracle.com>, ocfs2 now
>   writes to the inode atime field. This doesn't require any disk changes,
>   and is completely backwards compatible with older ocfs2 versions. An
>   inodes Atime is only updated if it hasn't changed within a certain
>   quantum. The user can define their own value at mount time, with 0
>   indicating that atime should always be updated. This is very similar to
>   the scheme implemented by gfs2. In the future, I'd like to see a "relative
>   atime" mode, which functions in the manner described by Valerie Henson at:
> 
> http://lkml.org/lkml/2006/8/25/380
> 
I'd like to second that. [adding Val Henson to the "to"] What (if
anything) remains to be done before the relative atime patch is ready to
go upstream? I'm happy to help out here if required,

Steve.



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

* Re: What's in ocfs2.git
  2006-12-04 10:54 ` Steven Whitehouse
@ 2006-12-05  0:10   ` Mark Fasheh
  2006-12-05  0:36     ` Relative atime (was Re: What's in ocfs2.git) Valerie Henson
  0 siblings, 1 reply; 13+ messages in thread
From: Mark Fasheh @ 2006-12-05  0:10 UTC (permalink / raw)
  To: Steven Whitehouse; +Cc: Valerie Henson, linux-kernel, ocfs2-devel

Hi Steve,

On Mon, Dec 04, 2006 at 10:54:53AM +0000, Steven Whitehouse wrote:
> > In the future, I'd like to see a "relative atime" mode, which functions
> > in the manner described by Valerie Henson at:
> > 
> > http://lkml.org/lkml/2006/8/25/380
> > 
> I'd like to second that. [adding Val Henson to the "to"] What (if
> anything) remains to be done before the relative atime patch is ready to
> go upstream? I'm happy to help out here if required,
Last time I looked at them, things seemed to be in pretty good shape - it
wasn't a very large patch series.

The thing is (I'm going from memory here), gfs2 and ocfs2 are likely to just
make use of the option parsing (and setting of the MNT_RELATIME flag), and
ignore the changes to touch_atime() since we we handle our own atime
updates.

Overall I think it's a matter of pushing the patches to the kernel and to
mount(8). For ocfs2/gfs2 we implement a small amount of the logic in our
"lock and update atime" functions.
	--Mark

--
Mark Fasheh
Senior Software Developer, Oracle
mark.fasheh@oracle.com

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

* Relative atime (was Re: What's in ocfs2.git)
  2006-12-05  0:10   ` Mark Fasheh
@ 2006-12-05  0:36     ` Valerie Henson
  2006-12-05  0:56       ` Valerie Henson
                         ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Valerie Henson @ 2006-12-05  0:36 UTC (permalink / raw)
  To: Mark Fasheh
  Cc: Steven Whitehouse, linux-kernel, ocfs2-devel, linux-fsdevel, Al Viro

On Mon, Dec 04, 2006 at 04:10:07PM -0800, Mark Fasheh wrote:
> Hi Steve,
> 
> On Mon, Dec 04, 2006 at 10:54:53AM +0000, Steven Whitehouse wrote:
> > > In the future, I'd like to see a "relative atime" mode, which functions
> > > in the manner described by Valerie Henson at:
> > > 
> > > http://lkml.org/lkml/2006/8/25/380
> > > 
> > I'd like to second that. [adding Val Henson to the "to"] What (if
> > anything) remains to be done before the relative atime patch is ready to
> > go upstream? I'm happy to help out here if required,
> Last time I looked at them, things seemed to be in pretty good shape - it
> wasn't a very large patch series.

Yep, the relative atime patch is tiny and pretty much done - just
needs some soak time in -mm and a little more review (cc'd Viro and
fsdevel).  Kernel patch against 2.6.18-rc4 appended, patch to mount
following. (Note that my web server suffered a RAID failure and my
patches page is unavailable till the restore finishes.)

-VAL

Add "relatime" (relative atime) support.  Relative atime only updates
the atime if the previous atime is older than the mtime or ctime.
Like noatime, but useful for applications like mutt that need to know
when a file has been read since it was last modified.

Signed-off-by: Valerie Henson <val_henson@linux.intel.com>

---
 fs/inode.c            |   11 ++++++++++-
 fs/namespace.c        |    5 ++++-
 include/linux/fs.h    |    1 +
 include/linux/mount.h |    1 +
 4 files changed, 16 insertions(+), 2 deletions(-)

--- linux-2.6.18-rc4-relatime.orig/fs/inode.c
+++ linux-2.6.18-rc4-relatime/fs/inode.c
@@ -1200,7 +1200,16 @@ void touch_atime(struct vfsmount *mnt, s
 		return;

 	now = current_fs_time(inode->i_sb);
-	if (!timespec_equal(&inode->i_atime, &now)) {
+	if (timespec_equal(&inode->i_atime, &now))
+		return;
+	/*
+	 * With relative atime, only update atime if the previous
+	 * atime is earlier than either the ctime or mtime.
+	 */
+	if (!mnt ||
+	    !(mnt->mnt_flags & MNT_RELATIME) ||
+	    (timespec_compare(&inode->i_atime, &inode->i_mtime) < 0) ||
+	    (timespec_compare(&inode->i_atime, &inode->i_ctime) < 0)) {
 		inode->i_atime = now;
 		mark_inode_dirty_sync(inode);
 	}
--- linux-2.6.18-rc4-relatime.orig/fs/namespace.c
+++ linux-2.6.18-rc4-relatime/fs/namespace.c
@@ -376,6 +376,7 @@ static int show_vfsmnt(struct seq_file *
 		{ MNT_NOEXEC, ",noexec" },
 		{ MNT_NOATIME, ",noatime" },
 		{ MNT_NODIRATIME, ",nodiratime" },
+		{ MNT_RELATIME, ",relatime" },
 		{ 0, NULL }
 	};
 	struct proc_fs_info *fs_infop;
@@ -1413,9 +1414,11 @@ long do_mount(char *dev_name, char *dir_
 		mnt_flags |= MNT_NOATIME;
 	if (flags & MS_NODIRATIME)
 		mnt_flags |= MNT_NODIRATIME;
+	if (flags & MS_RELATIME)
+		mnt_flags |= MNT_RELATIME;

 	flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE |
-		   MS_NOATIME | MS_NODIRATIME);
+		   MS_NOATIME | MS_NODIRATIME | MS_RELATIME);

 	/* ... and get the mountpoint */
 	retval = path_lookup(dir_name, LOOKUP_FOLLOW, &nd);
--- linux-2.6.18-rc4-relatime.orig/include/linux/fs.h
+++ linux-2.6.18-rc4-relatime/include/linux/fs.h
@@ -119,6 +119,7 @@ extern int dir_notify_enable;
 #define MS_PRIVATE	(1<<18)	/* change to private */
 #define MS_SLAVE	(1<<19)	/* change to slave */
 #define MS_SHARED	(1<<20)	/* change to shared */
+#define MS_RELATIME	(1<<21)	/* Update atime relative to mtime/ctime. */
 #define MS_ACTIVE	(1<<30)
 #define MS_NOUSER	(1<<31)

--- linux-2.6.18-rc4-relatime.orig/include/linux/mount.h
+++ linux-2.6.18-rc4-relatime/include/linux/mount.h
@@ -27,6 +27,7 @@ struct namespace;
 #define MNT_NOEXEC	0x04
 #define MNT_NOATIME	0x08
 #define MNT_NODIRATIME	0x10
+#define MNT_RELATIME	0x20

 #define MNT_SHRINKABLE	0x100

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

* Re: Relative atime (was Re: What's in ocfs2.git)
  2006-12-05  0:36     ` Relative atime (was Re: What's in ocfs2.git) Valerie Henson
@ 2006-12-05  0:56       ` Valerie Henson
  2006-12-05 22:20       ` Mark Fasheh
  2006-12-06  4:58       ` Andrew Morton
  2 siblings, 0 replies; 13+ messages in thread
From: Valerie Henson @ 2006-12-05  0:56 UTC (permalink / raw)
  To: Mark Fasheh
  Cc: Steven Whitehouse, linux-kernel, ocfs2-devel, linux-fsdevel, Al Viro

On Mon, Dec 04, 2006 at 04:36:20PM -0800, Valerie Henson wrote:
> On Mon, Dec 04, 2006 at 04:10:07PM -0800, Mark Fasheh wrote:
> > Hi Steve,
> > 
> > On Mon, Dec 04, 2006 at 10:54:53AM +0000, Steven Whitehouse wrote:
> > > > In the future, I'd like to see a "relative atime" mode, which functions
> > > > in the manner described by Valerie Henson at:
> > > > 
> > > > http://lkml.org/lkml/2006/8/25/380
> > > > 
> > > I'd like to second that. [adding Val Henson to the "to"] What (if
> > > anything) remains to be done before the relative atime patch is ready to
> > > go upstream? I'm happy to help out here if required,
> > Last time I looked at them, things seemed to be in pretty good shape - it
> > wasn't a very large patch series.

And the userland part.

-VAL

Add the "relatime" (relative atime) option support to mount.  Relative
atime only updates the atime if the previous atime is older than the
mtime or ctime.  Like noatime, but useful for applications like mutt
that need to know when a file has been read since it was last
modified.

Signed-off-by: Valerie Henson <val_henson@linux.intel.com>

---
 mount/mount.8           |    7 +++++++
 mount/mount.c           |    6 ++++++
 mount/mount_constants.h |    4 ++++
 3 files changed, 17 insertions(+)
--- util-linux-2.13-pre7.orig/mount/mount.8
+++ util-linux-2.13-pre7/mount/mount.8
@@ -586,6 +586,13 @@ access on the news spool to speed up new
 .B nodiratime
 Do not update directory inode access times on this filesystem.
 .TP
+.B relatime
+Update inode access times relative to modify or change time.  Access
+time is only updated if the previous access time was earlier than the
+current modify or change time. (Similar to noatime, but doesn't break
+mutt or other applications that need to know if a file has been read
+since the last time it was modified.)
+.TP
 .B noauto
 Can only be mounted explicitly (i.e., the
 .B \-a
--- util-linux-2.13-pre7.orig/mount/mount.c
+++ util-linux-2.13-pre7/mount/mount.c
@@ -164,6 +164,12 @@ static const struct opt_map opt_map[] =
   { "diratime",	0, 1, MS_NODIRATIME },	/* Update dir access times */
   { "nodiratime", 0, 0, MS_NODIRATIME },/* Do not update dir access times */
 #endif
+#ifdef MS_RELATIME
+  { "relatime", 0, 0, MS_RELATIME },	/* Update access times relative to
+					   mtime/ctime */
+  { "norelatime", 0, 1, MS_RELATIME },	/* Update access time without regard
+					   to mtime/ctime */
+#endif
   { NULL,	0, 0, 0		}
 };

--- util-linux-2.13-pre7.orig/mount/mount_constants.h
+++ util-linux-2.13-pre7/mount/mount_constants.h
@@ -57,6 +57,10 @@ if we have a stack or plain mount - moun
 #ifndef MS_VERBOSE
 #define MS_VERBOSE	0x8000	/* 32768 */
 #endif
+#ifndef MS_RELATIME
+#define MS_RELATIME   0x200000	/* 200000: Update access times relative
+				   to mtime/ctime */
+#endif
 /*
  * Magic mount flag number. Had to be or-ed to the flag values.
  */

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

* Re: Relative atime (was Re: What's in ocfs2.git)
  2006-12-05  0:36     ` Relative atime (was Re: What's in ocfs2.git) Valerie Henson
  2006-12-05  0:56       ` Valerie Henson
@ 2006-12-05 22:20       ` Mark Fasheh
  2006-12-06  6:11         ` Andrew Morton
  2006-12-06  4:58       ` Andrew Morton
  2 siblings, 1 reply; 13+ messages in thread
From: Mark Fasheh @ 2006-12-05 22:20 UTC (permalink / raw)
  To: Valerie Henson
  Cc: Steven Whitehouse, linux-kernel, ocfs2-devel, linux-fsdevel, Al Viro

On Mon, Dec 04, 2006 at 04:36:20PM -0800, Valerie Henson wrote:
> > Last time I looked at them, things seemed to be in pretty good shape - it
> > wasn't a very large patch series.
> 
> Yep, the relative atime patch is tiny and pretty much done - just
> needs some soak time in -mm and a little more review (cc'd Viro and
> fsdevel).  Kernel patch against 2.6.18-rc4 appended, patch to mount
> following. (Note that my web server suffered a RAID failure and my
> patches page is unavailable till the restore finishes.)

Well, here's what the ocfs2 patch would look like. If we care to push this
forward, some time in -mm would be nice...
	--Mark

From: Mark Fasheh <mark.fasheh@oracle.com>
Date: Tue, 5 Dec 2006 14:13:41 -0800
Subject: [PATCH] ocfs2: relative atime support

Update ocfs2_should_update_atime() to understand the MNT_RELATIME flag and
to test against mtime / ctime accordingly.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
---
 fs/ocfs2/file.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 8786b3c..16a9b5e 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -154,6 +154,15 @@ int ocfs2_should_update_atime(struct ino
 		return 0;
 
 	now = CURRENT_TIME;
+
+	if (vfsmnt->mnt_flags & MNT_RELATIME) {
+		if ((timespec_compare(&inode->i_atime, &inode->i_mtime) < 0) ||
+		    (timespec_compare(&inode->i_atime, &inode->i_ctime) < 0))
+			return 1;
+
+		return 0;
+	}
+
 	if ((now.tv_sec - inode->i_atime.tv_sec <= osb->s_atime_quantum))
 		return 0;
 	else
-- 
1.4.2.4


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

* Re: Relative atime (was Re: What's in ocfs2.git)
  2006-12-05  0:36     ` Relative atime (was Re: What's in ocfs2.git) Valerie Henson
  2006-12-05  0:56       ` Valerie Henson
  2006-12-05 22:20       ` Mark Fasheh
@ 2006-12-06  4:58       ` Andrew Morton
  2006-12-06  8:58         ` Valerie Henson
                           ` (2 more replies)
  2 siblings, 3 replies; 13+ messages in thread
From: Andrew Morton @ 2006-12-06  4:58 UTC (permalink / raw)
  To: Valerie Henson
  Cc: mark.fasheh, steve, linux-kernel, ocfs2-devel, linux-fsdevel, viro

> On Mon, 4 Dec 2006 16:36:20 -0800 Valerie Henson <val_henson@linux.intel.com> wrote:
> Add "relatime" (relative atime) support.  Relative atime only updates
> the atime if the previous atime is older than the mtime or ctime.
> Like noatime, but useful for applications like mutt that need to know
> when a file has been read since it was last modified.

That seems like a good idea.

I found touch_atime() to be rather putrid, so I hacked it around a bit.  The
end result:

void touch_atime(struct vfsmount *mnt, struct dentry *dentry)
{
	struct inode *inode = dentry->d_inode;
	struct timespec now;

	if (IS_RDONLY(inode))
		return;
	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) {
		if (mnt->mnt_flags & MNT_NOATIME)
			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))
		return;

	inode->i_atime = now;
	mark_inode_dirty_sync(inode);
}

Does it still look right?

Note the reordering to avoid the current_fs_time() call if poss.


That's the easy part.   How are we going to get mount(8) patched?


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

* Re: Relative atime (was Re: What's in ocfs2.git)
  2006-12-05 22:20       ` Mark Fasheh
@ 2006-12-06  6:11         ` Andrew Morton
  0 siblings, 0 replies; 13+ messages in thread
From: Andrew Morton @ 2006-12-06  6:11 UTC (permalink / raw)
  To: Mark Fasheh
  Cc: Valerie Henson, Steven Whitehouse, linux-kernel, ocfs2-devel,
	linux-fsdevel, Al Viro

On Tue, 5 Dec 2006 14:20:27 -0800
Mark Fasheh <mark.fasheh@oracle.com> wrote:

> Update ocfs2_should_update_atime() to understand the MNT_RELATIME flag and
> to test against mtime / ctime accordingly.
> 
> ...
>
> --- a/fs/ocfs2/file.c
> +++ b/fs/ocfs2/file.c
> @@ -154,6 +154,15 @@ int ocfs2_should_update_atime(struct ino
>  		return 0;
>  
>  	now = CURRENT_TIME;
> +
> +	if (vfsmnt->mnt_flags & MNT_RELATIME) {
> +		if ((timespec_compare(&inode->i_atime, &inode->i_mtime) < 0) ||
> +		    (timespec_compare(&inode->i_atime, &inode->i_ctime) < 0))
> +			return 1;
> +
> +		return 0;

So if atime == mtime == ctime, we don't update the atime.

I think we should.  It seems risky to leave them all equal.

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

* Re: Relative atime (was Re: What's in ocfs2.git)
  2006-12-06  4:58       ` Andrew Morton
@ 2006-12-06  8:58         ` Valerie Henson
  2006-12-06  9:42         ` Eric Dumazet
  2006-12-09  3:15         ` Valerie Henson
  2 siblings, 0 replies; 13+ messages in thread
From: Valerie Henson @ 2006-12-06  8:58 UTC (permalink / raw)
  To: Andrew Morton
  Cc: mark.fasheh, steve, linux-kernel, ocfs2-devel, linux-fsdevel, viro

On Tue, Dec 05, 2006 at 08:58:02PM -0800, Andrew Morton wrote:
> > On Mon, 4 Dec 2006 16:36:20 -0800 Valerie Henson <val_henson@linux.intel.com> wrote:
> > Add "relatime" (relative atime) support.  Relative atime only updates
> > the atime if the previous atime is older than the mtime or ctime.
> > Like noatime, but useful for applications like mutt that need to know
> > when a file has been read since it was last modified.
> 
> That seems like a good idea.
> 
> I found touch_atime() to be rather putrid, so I hacked it around a bit.  The
> end result:

I like that rather better - add my:

Signed-off-by: Valerie Henson <val_henson@linux.intel.com>

> That's the easy part.   How are we going to get mount(8) patched?

Well, the nodiratime documentation got in. (I was going to add that as
part of this apatch, but lo and behold.)

-VAL

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

* Re: Relative atime (was Re: What's in ocfs2.git)
  2006-12-06  4:58       ` Andrew Morton
  2006-12-06  8:58         ` Valerie Henson
@ 2006-12-06  9:42         ` Eric Dumazet
  2006-12-06 12:48           ` Arjan van de Ven
  2006-12-09  3:15         ` Valerie Henson
  2 siblings, 1 reply; 13+ messages in thread
From: Eric Dumazet @ 2006-12-06  9:42 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Valerie Henson, mark.fasheh, steve, linux-kernel, ocfs2-devel,
	linux-fsdevel, viro

On Wednesday 06 December 2006 05:58, Andrew Morton wrote:
> > On Mon, 4 Dec 2006 16:36:20 -0800 Valerie Henson
> > <val_henson@linux.intel.com> wrote: Add "relatime" (relative atime)
> > support.  Relative atime only updates the atime if the previous atime is
> > older than the mtime or ctime. Like noatime, but useful for applications
> > like mutt that need to know when a file has been read since it was last
> > modified.
>
> That seems like a good idea.
>
> I found touch_atime() to be rather putrid, so I hacked it around a bit. 

I find this function full of tests...

> The end result:
>
> void touch_atime(struct vfsmount *mnt, struct dentry *dentry)
> {
> 	struct inode *inode = dentry->d_inode;
> 	struct timespec now;
>
> 	if (IS_RDONLY(inode))
> 		return;

While we are adding new tests, we could try to be smart here testing both 
MS_RDONLY and MS_NOATIME.

if (__IS_FLG(inode, MS_RDONLY | MS_NOATIME))
	return;

> 	if (inode->i_flags & S_NOATIME)
> 		return;

> 	if (inode->i_sb->s_flags & MS_NOATIME)
> 		return;
So that that one can be deleted.

>        if ((inode->i_sb->s_flags & MS_NODIRATIME) && S_ISDIR(inode->i_mode))
>                return;

	if (__IS_FLG(inode, MS_NODIRATIME) && S_ISDIR(inode->i_mode))
		return;

Eric

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

* Re: Relative atime (was Re: What's in ocfs2.git)
  2006-12-06  9:42         ` Eric Dumazet
@ 2006-12-06 12:48           ` Arjan van de Ven
  0 siblings, 0 replies; 13+ messages in thread
From: Arjan van de Ven @ 2006-12-06 12:48 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Andrew Morton, Valerie Henson, mark.fasheh, steve, linux-kernel,
	ocfs2-devel, linux-fsdevel, viro



> 
> > 	if (inode->i_sb->s_flags & MS_NOATIME)
> > 		return;
> So that that one can be deleted.


Hi,

I would mostly expect the compiler to be relatively smart about this and
group a bunch of these tests together... so I rather see readable code
than optimized code for something the compiler should be doing for us ;)

Greetings,
   Arjan van de Ven


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

* Re: Relative atime (was Re: What's in ocfs2.git)
  2006-12-06  4:58       ` Andrew Morton
  2006-12-06  8:58         ` Valerie Henson
  2006-12-06  9:42         ` Eric Dumazet
@ 2006-12-09  3:15         ` Valerie Henson
  2006-12-12  9:30           ` Karel Zak
  2 siblings, 1 reply; 13+ messages in thread
From: Valerie Henson @ 2006-12-09  3:15 UTC (permalink / raw)
  To: Andrew Morton
  Cc: mark.fasheh, steve, linux-kernel, ocfs2-devel, linux-fsdevel,
	viro, Karel Zak

On Tue, Dec 05, 2006 at 08:58:02PM -0800, Andrew Morton wrote:
> That's the easy part.   How are we going to get mount(8) patched?

Karel, interested in taking a look at the following patch?  The kernel
bits are in -mm currently.

-VAL

Add the "relatime" (relative atime) option support to mount.  Relative
atime only updates the atime if the previous atime is older than the
mtime or ctime.  Like noatime, but useful for applications like mutt
that need to know when a file has been read since it was last
modified.

Cc: Adrian Bunk <bunk@stusta.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Karel Zak <kzak@redhat.com>

Signed-off-by: Valerie Henson <val_henson@linux.intel.com>

---
 mount/mount.8           |    7 +++++++
 mount/mount.c           |    6 ++++++
 mount/mount_constants.h |    4 ++++
 3 files changed, 17 insertions(+)

--- util-linux-2.13-pre7.orig/mount/mount.8
+++ util-linux-2.13-pre7/mount/mount.8
@@ -586,6 +586,13 @@ access on the news spool to speed up new
 .B nodiratime
 Do not update directory inode access times on this filesystem.
 .TP
+.B relatime
+Update inode access times relative to modify or change time.  Access
+time is only updated if the previous access time was earlier than the
+current modify or change time. (Similar to noatime, but doesn't break
+mutt or other applications that need to know if a file has been read
+since the last time it was modified.)
+.TP
 .B noauto
 Can only be mounted explicitly (i.e., the
 .B \-a
--- util-linux-2.13-pre7.orig/mount/mount.c
+++ util-linux-2.13-pre7/mount/mount.c
@@ -164,6 +164,12 @@ static const struct opt_map opt_map[] = 
   { "diratime",	0, 1, MS_NODIRATIME },	/* Update dir access times */
   { "nodiratime", 0, 0, MS_NODIRATIME },/* Do not update dir access times */
 #endif
+#ifdef MS_RELATIME
+  { "relatime", 0, 0, MS_RELATIME },	/* Update access times relative to
+					   mtime/ctime */
+  { "norelatime", 0, 1, MS_RELATIME },	/* Update access time without regard
+					   to mtime/ctime */
+#endif
   { NULL,	0, 0, 0		}
 };
 
--- util-linux-2.13-pre7.orig/mount/mount_constants.h
+++ util-linux-2.13-pre7/mount/mount_constants.h
@@ -57,6 +57,10 @@ if we have a stack or plain mount - moun
 #ifndef MS_VERBOSE
 #define MS_VERBOSE	0x8000	/* 32768 */
 #endif
+#ifndef MS_RELATIME
+#define MS_RELATIME   0x200000	/* 200000: Update access times relative
+				   to mtime/ctime */
+#endif
 /*
  * Magic mount flag number. Had to be or-ed to the flag values.
  */

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

* Re: Relative atime (was Re: What's in ocfs2.git)
  2006-12-09  3:15         ` Valerie Henson
@ 2006-12-12  9:30           ` Karel Zak
  0 siblings, 0 replies; 13+ messages in thread
From: Karel Zak @ 2006-12-12  9:30 UTC (permalink / raw)
  To: Valerie Henson
  Cc: Andrew Morton, mark.fasheh, steve, linux-kernel, ocfs2-devel,
	linux-fsdevel, viro

On Fri, Dec 08, 2006 at 07:15:14PM -0800, Valerie Henson wrote:
> On Tue, Dec 05, 2006 at 08:58:02PM -0800, Andrew Morton wrote:
> > That's the easy part.   How are we going to get mount(8) patched?
> 
> Karel, interested in taking a look at the following patch?  The kernel
> bits are in -mm currently.

 The patch looks good. I'll add it to my development util-linux tree.
 Thanks.

    Karel

> Add the "relatime" (relative atime) option support to mount.  Relative
> atime only updates the atime if the previous atime is older than the
> mtime or ctime.  Like noatime, but useful for applications like mutt
> that need to know when a file has been read since it was last
> modified.
> 
> Cc: Adrian Bunk <bunk@stusta.de>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Cc: Karel Zak <kzak@redhat.com>
> 
> Signed-off-by: Valerie Henson <val_henson@linux.intel.com>
> 
> ---
>  mount/mount.8           |    7 +++++++
>  mount/mount.c           |    6 ++++++
>  mount/mount_constants.h |    4 ++++
>  3 files changed, 17 insertions(+)
> 
> --- util-linux-2.13-pre7.orig/mount/mount.8
> +++ util-linux-2.13-pre7/mount/mount.8
> @@ -586,6 +586,13 @@ access on the news spool to speed up new
>  .B nodiratime
>  Do not update directory inode access times on this filesystem.
>  .TP
> +.B relatime
> +Update inode access times relative to modify or change time.  Access
> +time is only updated if the previous access time was earlier than the
> +current modify or change time. (Similar to noatime, but doesn't break
> +mutt or other applications that need to know if a file has been read
> +since the last time it was modified.)
> +.TP
>  .B noauto
>  Can only be mounted explicitly (i.e., the
>  .B \-a
> --- util-linux-2.13-pre7.orig/mount/mount.c
> +++ util-linux-2.13-pre7/mount/mount.c
> @@ -164,6 +164,12 @@ static const struct opt_map opt_map[] = 
>    { "diratime",	0, 1, MS_NODIRATIME },	/* Update dir access times */
>    { "nodiratime", 0, 0, MS_NODIRATIME },/* Do not update dir access times */
>  #endif
> +#ifdef MS_RELATIME
> +  { "relatime", 0, 0, MS_RELATIME },	/* Update access times relative to
> +					   mtime/ctime */
> +  { "norelatime", 0, 1, MS_RELATIME },	/* Update access time without regard
> +					   to mtime/ctime */
> +#endif
>    { NULL,	0, 0, 0		}
>  };
>  
> --- util-linux-2.13-pre7.orig/mount/mount_constants.h
> +++ util-linux-2.13-pre7/mount/mount_constants.h
> @@ -57,6 +57,10 @@ if we have a stack or plain mount - moun
>  #ifndef MS_VERBOSE
>  #define MS_VERBOSE	0x8000	/* 32768 */
>  #endif
> +#ifndef MS_RELATIME
> +#define MS_RELATIME   0x200000	/* 200000: Update access times relative
> +				   to mtime/ctime */
> +#endif
>  /*
>   * Magic mount flag number. Had to be or-ed to the flag values.
>   */
> -
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
 Karel Zak  <kzak@redhat.com>

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

end of thread, other threads:[~2006-12-12  9:30 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-03 20:31 What's in ocfs2.git Mark Fasheh
2006-12-04 10:54 ` Steven Whitehouse
2006-12-05  0:10   ` Mark Fasheh
2006-12-05  0:36     ` Relative atime (was Re: What's in ocfs2.git) Valerie Henson
2006-12-05  0:56       ` Valerie Henson
2006-12-05 22:20       ` Mark Fasheh
2006-12-06  6:11         ` Andrew Morton
2006-12-06  4:58       ` Andrew Morton
2006-12-06  8:58         ` Valerie Henson
2006-12-06  9:42         ` Eric Dumazet
2006-12-06 12:48           ` Arjan van de Ven
2006-12-09  3:15         ` Valerie Henson
2006-12-12  9:30           ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).