提交 d0adde57 编写于 作者: M Matthew Garrett 提交者: Linus Torvalds

Add a strictatime mount option

Add support for explicitly requesting full atime updates. This makes it
possible for kernels to default to relatime but still allow userspace to
override it.
Signed-off-by: NMatthew Garrett <mjg@redhat.com>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 11ff6f05
...@@ -780,6 +780,7 @@ static void show_mnt_opts(struct seq_file *m, struct vfsmount *mnt) ...@@ -780,6 +780,7 @@ static void show_mnt_opts(struct seq_file *m, struct vfsmount *mnt)
{ MNT_NOATIME, ",noatime" }, { MNT_NOATIME, ",noatime" },
{ MNT_NODIRATIME, ",nodiratime" }, { MNT_NODIRATIME, ",nodiratime" },
{ MNT_RELATIME, ",relatime" }, { MNT_RELATIME, ",relatime" },
{ MNT_STRICTATIME, ",strictatime" },
{ 0, NULL } { 0, NULL }
}; };
const struct proc_fs_info *fs_infop; const struct proc_fs_info *fs_infop;
...@@ -1932,11 +1933,14 @@ long do_mount(char *dev_name, char *dir_name, char *type_page, ...@@ -1932,11 +1933,14 @@ long do_mount(char *dev_name, char *dir_name, char *type_page,
mnt_flags |= MNT_NODIRATIME; mnt_flags |= MNT_NODIRATIME;
if (flags & MS_RELATIME) if (flags & MS_RELATIME)
mnt_flags |= MNT_RELATIME; mnt_flags |= MNT_RELATIME;
if (flags & MS_STRICTATIME)
mnt_flags &= ~(MNT_RELATIME | MNT_NOATIME);
if (flags & MS_RDONLY) if (flags & MS_RDONLY)
mnt_flags |= MNT_READONLY; mnt_flags |= MNT_READONLY;
flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE | flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE |
MS_NOATIME | MS_NODIRATIME | MS_RELATIME| MS_KERNMOUNT); MS_NOATIME | MS_NODIRATIME | MS_RELATIME| MS_KERNMOUNT |
MS_STRICTATIME);
/* ... and get the mountpoint */ /* ... and get the mountpoint */
retval = kern_path(dir_name, LOOKUP_FOLLOW, &path); retval = kern_path(dir_name, LOOKUP_FOLLOW, &path);
......
...@@ -141,6 +141,7 @@ struct inodes_stat_t { ...@@ -141,6 +141,7 @@ struct inodes_stat_t {
#define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */ #define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */
#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ #define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
#define MS_I_VERSION (1<<23) /* Update inode I_version field */ #define MS_I_VERSION (1<<23) /* Update inode I_version field */
#define MS_STRICTATIME (1<<24) /* Always perform atime updates */
#define MS_ACTIVE (1<<30) #define MS_ACTIVE (1<<30)
#define MS_NOUSER (1<<31) #define MS_NOUSER (1<<31)
......
...@@ -27,6 +27,7 @@ struct mnt_namespace; ...@@ -27,6 +27,7 @@ struct mnt_namespace;
#define MNT_NODIRATIME 0x10 #define MNT_NODIRATIME 0x10
#define MNT_RELATIME 0x20 #define MNT_RELATIME 0x20
#define MNT_READONLY 0x40 /* does the user want this to be r/o? */ #define MNT_READONLY 0x40 /* does the user want this to be r/o? */
#define MNT_STRICTATIME 0x80
#define MNT_SHRINKABLE 0x100 #define MNT_SHRINKABLE 0x100
#define MNT_IMBALANCED_WRITE_COUNT 0x200 /* just for debugging */ #define MNT_IMBALANCED_WRITE_COUNT 0x200 /* just for debugging */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册