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

Tiger Yang tiger.yang at oracle.com
Mon Mar 2 18:23:56 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            |    4 ++++
 3 files changed, 15 insertions(+), 0 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..f834c9e 100644
--- a/mount.ocfs2/opts.c
+++ b/mount.ocfs2/opts.c
@@ -84,6 +84,10 @@ static const struct opt_map opt_map[] = {
   { "atime",	0, 1, MS_NOATIME },	/* Update access time */
   { "noatime",	0, 0, MS_NOATIME },	/* Do not update access time */
 #endif
+#ifdef MS_RELATIME
+  { "relatime",	0, 0, MS_RELATIME },	/* only update atime if previous */
+					/* atime is older than mtime/ctime */
+#endif
 #ifdef MS_NODIRATIME
   { "diratime",	0, 1, MS_NODIRATIME },	/* Update dir access times */
   { "nodiratime", 0, 0, MS_NODIRATIME },/* Do not update dir access times */
-- 
1.5.4.1




More information about the Ocfs2-tools-devel mailing list