[Ocfs2-tools-devel] [PATCH 1/1] ocfs2-tools: add mount option for relatime support v2

Tiger Yang tiger.yang at oracle.com
Wed Mar 4 01:21:44 PST 2009


This patch add mount option relatime in ocfs2.
relatime only update atime if the previous atime is
older than mtime or ctime. We have already support this
feature in mainline kernel at 2.6.20.

Signed-off-by: Tiger Yang <tiger.yang at oracle.com>
---
 mount.ocfs2/mount.ocfs2.8.in  |    8 ++++++++
 mount.ocfs2/mount_constants.h |    3 +++
 mount.ocfs2/opts.c            |    8 ++------
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/mount.ocfs2/mount.ocfs2.8.in b/mount.ocfs2/mount.ocfs2.8.in
index 0f666dd..3190ba5 100644
--- a/mount.ocfs2/mount.ocfs2.8.in
+++ b/mount.ocfs2/mount.ocfs2.8.in
@@ -25,6 +25,14 @@ The file system will not update atime unless this number of seconds has passed
 since the last update. Set to zero to always update atime. It defaults to 60 secs.
 
 .TP
+\fBrelatime\fR
+The file system only update atime if the previous atime is older than mtime or ctime.
+
+.TP
+\fBnoatime\fR
+The file system will not update access time.
+
+.TP
 \fBcommit=nrsec\fR
 Sync all data and metadata every nrsec seconds. The default value is 5 seconds.
 Zero means default.
diff --git a/mount.ocfs2/mount_constants.h b/mount.ocfs2/mount_constants.h
index 61e8969..ed475db 100644
--- a/mount.ocfs2/mount_constants.h
+++ b/mount.ocfs2/mount_constants.h
@@ -57,6 +57,9 @@ if we have a stack or plain mount - mount atop of it, forming a stack. */
 #ifndef MS_VERBOSE
 #define MS_VERBOSE	0x8000	/* 32768 */
 #endif
+#ifndef MS_RELATIME
+#define MS_RELATIME	(1<<21)	/* Update atime relative to mtime/ctime. */
+#endif
 /*
  * Magic mount flag number. Had to be or-ed to the flag values.
  */
diff --git a/mount.ocfs2/opts.c b/mount.ocfs2/opts.c
index f90ef54..5ecd36b 100644
--- a/mount.ocfs2/opts.c
+++ b/mount.ocfs2/opts.c
@@ -75,19 +75,15 @@ static const struct opt_map opt_map[] = {
   { "quiet",	0, 0, MS_SILENT    },	/* be quiet  */
   { "loud",	0, 1, MS_SILENT    },	/* print out messages. */
 #endif
-#ifdef MS_MANDLOCK
   { "mand",	0, 0, MS_MANDLOCK },	/* Allow mandatory locks on this FS */
   { "nomand",	0, 1, MS_MANDLOCK },	/* Forbid mandatory locks on this FS */
-#endif
   { "loop",	1, 0, MS_LOOP	},	/* use a loop device */
-#ifdef MS_NOATIME
   { "atime",	0, 1, MS_NOATIME },	/* Update access time */
   { "noatime",	0, 0, MS_NOATIME },	/* Do not update access time */
-#endif
-#ifdef MS_NODIRATIME
+  { "relatime",	0, 0, MS_RELATIME },	/* only update atime if previous */
+					/* atime is older than mtime/ctime */
   { "diratime",	0, 1, MS_NODIRATIME },	/* Update dir access times */
   { "nodiratime", 0, 0, MS_NODIRATIME },/* Do not update dir access times */
-#endif
   { "kudzu",	0, 0, MS_COMMENT },	/* Silently remove this option (backwards compat use only) */
   { "managed",	0, 0, MS_COMMENT },	/* Silently remove this option */
   { NULL,	0, 0, 0	}
-- 
1.5.4.1




More information about the Ocfs2-tools-devel mailing list