From: Valerie Henson Date: Sat, 9 Dec 2006 03:15:14 +0000 (-0800) Subject: mount: relative atime support X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e12b670afa4bfe2b9433d42783628bcdf61dffc;p=util-linux mount: relative atime support 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 Cc: Al Viro Cc: Karel Zak Signed-off-by: Valerie Henson --- diff --git a/mount/mount.8 b/mount/mount.8 index 870cfd13..2d7c2189 100644 --- a/mount/mount.8 +++ b/mount/mount.8 @@ -621,6 +621,13 @@ access on the news spool to speed up news servers). .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 diff --git a/mount/mount.c b/mount/mount.c index 1d179b72..63e67313 100644 --- a/mount/mount.c +++ b/mount/mount.c @@ -177,6 +177,12 @@ static const struct opt_map opt_map[] = { #ifdef MS_NODIRATIME { "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 } }; diff --git a/mount/mount_constants.h b/mount/mount_constants.h index 5c3897f8..dc3ca274 100644 --- a/mount/mount_constants.h +++ b/mount/mount_constants.h @@ -57,6 +57,10 @@ 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 0x200000 /* 200000: Update access times relative + to mtime/ctime */ +#endif #ifndef MS_UNBINDABLE #define MS_UNBINDABLE (1<<17) /* 131072 unbindable*/ #endif