From: Randy Dunlap <randy.dunlap@oracle.com>
To: Matthew Garrett <mjg@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
mingo@redhat.com, val.henson@gmail.com
Subject: Re: [PATCH 2/2] relatime: Allow making relatime the default behaviour
Date: Wed, 26 Nov 2008 14:39:49 -0800 [thread overview]
Message-ID: <492DD035.5020705@oracle.com> (raw)
In-Reply-To: <20081126195824.GB3541@srcf.ucam.org>
Matthew Garrett wrote:
> Allow the kernel to enable relatime on all mounts by default. This can
> be configured at build time or by a kernel parameter or sysctl. Also add
> an MS_NORELATIME mount option to allow the default to be overridden for
> specific mount points.
>
> Signed-off-by: Matthew Garrett <mjg@redhat.com>
>
> ---
Hi,
Please use diffstat for all (non-trivial) patches.
or whatever git calls it.
Comments below...
> Updated version of Ingo's patch, but adds MS_NORELATIME. util-linux will
> need updating to match if this is merged.
>
> diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
> index e0f346d..eba3b07 100644
> --- a/Documentation/kernel-parameters.txt
> +++ b/Documentation/kernel-parameters.txt
> @@ -616,6 +616,10 @@ and is between 256 and 4096 characters. It is defined in the file
> This is a 16-member array composed of values
> ranging from 0-255.
>
> + default_relatime=
> + [FS] mount all filesystems with relative atime
> + updates by default.
> +
I had rather see it called "relatime_default" fwiw.
> vt.default_utf8=
> [VT]
> Format=<0|1>
> @@ -1847,6 +1851,10 @@ and is between 256 and 4096 characters. It is defined in the file
> [KNL, SMP] Set scheduler's default relax_domain_level.
> See Documentation/cpusets.txt.
>
> + relatime_interval=
> + [FS] relative atime update frequency, in seconds.
> + (default: 1 day: 86400 seconds)
> +
> reserve= [KNL,BUGS] Force the kernel to ignore some iomem area
>
> reservetop= [X86-32]
> diff --git a/fs/Kconfig b/fs/Kconfig
> index 522469a..fcd3d48 100644
> --- a/fs/Kconfig
> +++ b/fs/Kconfig
> @@ -1546,6 +1546,29 @@ config 9P_FS
>
> endif # NETWORK_FILESYSTEMS
>
> +config DEFAULT_RELATIME
> + bool "Mount all filesystems with relatime by default"
> + default y
> + help
> + If you say Y here, all your filesystems will be mounted
> + with the "relatime" mount option. This eliminates many atime
> + ('file last accessed' timestamp) updates (which otherwise
> + is performed on every file access and generates a write
> + IO to the inode) and thus speeds up IO. Atime is still updated,
> + but only once per day.
> +
> + The mtime ('file last modified') and ctime ('file created')
> + timestamp are unaffected by this change.
> +
> + Use the "norelatime" kernel boot option to turn off this
> + feature.
> +
> +config DEFAULT_RELATIME_VAL
> + int
> + default "1" if DEFAULT_RELATIME
> + default "0"
> +
> +
> if BLOCK
> menu "Partition Types"
>
> diff --git a/fs/inode.c b/fs/inode.c
> index 348fa16..51e9ae1 100644
> --- a/fs/inode.c
> +++ b/fs/inode.c
> @@ -1185,6 +1185,17 @@ EXPORT_SYMBOL(bmap);
> int relatime_interval __read_mostly = 24*60*60;
>
> /*
> + * Allow overriding the default relatime value on the kernel command line
> + */
> +static int __init set_relatime_interval(char *str)
> +{
> + get_option(&str, &relatime_interval);
> +
> + return 1;
> +}
> +__setup("relatime_interval=", set_relatime_interval);
> +
> +/*
> * With relative atime, only update atime if the
> * previous atime is earlier than either the ctime or
> * mtime.
> diff --git a/fs/namespace.c b/fs/namespace.c
> index 65b3dc8..76f30b5 100644
> --- a/fs/namespace.c
> +++ b/fs/namespace.c
> @@ -1883,6 +1883,24 @@ int copy_mount_options(const void __user * data, unsigned long *where)
> }
>
> /*
> + * Allow users to disable (or enable) atime updates via a .config
> + * option or via the boot line, or via /proc/sys/fs/default_relatime:
> + */
> +int default_relatime __read_mostly = CONFIG_DEFAULT_RELATIME_VAL;
> +
> +static int __init set_default_relatime(char *str)
> +{
> + get_option(&str, &default_relatime);
> +
> + printk(KERN_INFO "Mount all filesystems with"
missing a space between "with" and "default".
> + "default relative atime updates: %s.\n",
> + default_relatime ? "enabled" : "disabled");
> +
> + return 1;
> +}
> +__setup("default_relatime=", set_default_relatime);
> +
> +/*
> * Flags is a 32-bit value that allows up to 31 non-fs dependent flags to
> * be given to the mount() call (ie: read-only, no-dev, no-suid etc).
> *
> @@ -1930,6 +1948,11 @@ long do_mount(char *dev_name, char *dir_name, char *type_page,
> mnt_flags |= MNT_NODIRATIME;
> if (flags & MS_RELATIME)
> mnt_flags |= MNT_RELATIME;
> + else if (default_relatime &&
> + !(flags & (MS_NOATIME | MS_NODIRATIME | MS_NORELATIME))) {
> + mnt_flags |= MNT_RELATIME;
> + flags |= MS_RELATIME;
> + }
> if (flags & MS_RDONLY)
> mnt_flags |= MNT_READONLY;
>
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 0dcdd94..a4db010 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -135,6 +135,7 @@ extern int dir_notify_enable;
> #define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */
> #define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
> #define MS_I_VERSION (1<<23) /* Update inode I_version field */
> +#define MS_NORELATIME (1<<24) /* Disable relatie even if the default */
relatime
> #define MS_ACTIVE (1<<30)
> #define MS_NOUSER (1<<31)
--
~Randy
next prev parent reply other threads:[~2008-11-26 22:40 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-26 19:54 [PATCH 1/2] relatime: Make atime updates more useful Matthew Garrett
2008-11-26 19:58 ` [PATCH 2/2] relatime: Allow making relatime the default behaviour Matthew Garrett
2008-11-26 21:11 ` Matthew Wilcox
2008-11-26 22:39 ` Randy Dunlap [this message]
2008-11-27 15:01 ` [PATCH v2 1/2] relatime: Make relatime behaviour smarter Matthew Garrett
2008-11-27 15:03 ` [PATCH v2 2/2] relatime: Allow making relatime the default behaviour Matthew Garrett
2008-11-27 15:07 ` Ingo Molnar
2008-11-27 16:03 ` Karel Zak
[not found] ` <20081127160353.GQ2961-sHeGUpI7y9L/9pzu0YdTqQ@public.gmane.org>
2008-11-27 17:30 ` Pádraig Brady
[not found] ` <492ED945.5010600-V8g9lnOeT5ydJdNcDFJN0w@public.gmane.org>
2008-11-27 17:39 ` Matthew Garrett
2008-11-27 16:35 ` Alan Cox
2008-11-27 16:47 ` Matthew Garrett
2008-11-27 16:59 ` [PATCH v3] relatime: Make relatime smarter Matthew Garrett
2008-11-27 17:06 ` Christoph Hellwig
2008-11-27 17:58 ` [PATCH v4] " Matthew Garrett
2008-11-27 22:08 ` Andreas Dilger
2008-11-27 22:35 ` Matthew Wilcox
2008-11-28 11:13 ` Jamie Lokier
2008-11-28 13:41 ` Matthew Garrett
2008-11-28 11:18 ` Jamie Lokier
2008-11-28 13:40 ` Matthew Wilcox
2008-11-28 13:47 ` Matthew Garrett
2008-12-02 11:10 ` Karel Zak
2008-12-02 16:46 ` Matthew Wilcox
2008-11-27 19:15 ` [PATCH v3] " Alan Cox
2008-11-28 11:16 ` Jamie Lokier
2008-11-28 13:45 ` Matthew Garrett
2008-11-27 17:03 ` [PATCH v2 2/2] relatime: Allow making relatime the default behaviour Christoph Hellwig
2008-11-29 8:24 ` Andrew Morton
2008-11-29 13:03 ` Matthew Wilcox
2008-11-29 13:57 ` Jörn Engel
2008-11-29 18:56 ` Jamie Lokier
2008-11-29 19:02 ` Matthew Garrett
2008-11-29 20:32 ` Andrew Morton
2008-11-29 20:38 ` Matthew Wilcox
2008-11-29 20:56 ` Andrew Morton
2008-11-29 21:41 ` Ingo Molnar
2008-11-29 20:55 ` Arjan van de Ven
2008-11-29 21:03 ` Matthew Garrett
2008-11-29 21:02 ` Matthew Garrett
2008-11-27 15:06 ` [PATCH v2 1/2] relatime: Make relatime behaviour smarter Ingo Molnar
2008-11-29 8:29 ` [PATCH 1/2] relatime: Make atime updates more useful Andrew Morton
2008-12-02 17:19 ` [PATCH] relatime: Let relatime update atime at least once per day Matthew Garrett
2008-12-13 5:26 ` Valerie Aurora Henson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=492DD035.5020705@oracle.com \
--to=randy.dunlap@oracle.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=mjg@redhat.com \
--cc=val.henson@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).