rpms/kernel/F-10 fs-relatime-add-strictatime-option.patch, NONE, 1.1 fs-relatime-make-default.patch, NONE, 1.1 fs-relatime-update-once-per-day.patch, NONE, 1.1 kernel.spec, 1.1305, 1.1306

Chuck Ebbert cebbert at fedoraproject.org
Thu Mar 26 19:53:51 UTC 2009


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-10
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv29669

Modified Files:
	kernel.spec 
Added Files:
	fs-relatime-add-strictatime-option.patch 
	fs-relatime-make-default.patch 
	fs-relatime-update-once-per-day.patch 
Log Message:
Add upstream relatime patches but don't make relatime the default.

fs-relatime-add-strictatime-option.patch:

--- NEW FILE fs-relatime-add-strictatime-option.patch ---
From: Matthew Garrett <mjg at redhat.com>
Date: Thu, 26 Mar 2009 17:49:56 +0000 (+0000)
Subject: Add a strictatime mount option
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=d0adde574b8487ef30f69e2d08bba769e4be513f

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: Matthew Garrett <mjg at redhat.com>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---

diff --git a/fs/namespace.c b/fs/namespace.c
index 06f8e63..d0659ec 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -780,6 +780,7 @@ static void show_mnt_opts(struct seq_file *m, struct vfsmount *mnt)
 		{ MNT_NOATIME, ",noatime" },
 		{ MNT_NODIRATIME, ",nodiratime" },
 		{ MNT_RELATIME, ",relatime" },
+		{ MNT_STRICTATIME, ",strictatime" },
 		{ 0, NULL }
 	};
 	const struct proc_fs_info *fs_infop;
@@ -1932,11 +1933,14 @@ long do_mount(char *dev_name, char *dir_name, char *type_page,
 		mnt_flags |= MNT_NODIRATIME;
 	if (flags & MS_RELATIME)
 		mnt_flags |= MNT_RELATIME;
+	if (flags & MS_STRICTATIME)
+		mnt_flags &= ~(MNT_RELATIME | MNT_NOATIME);
 	if (flags & MS_RDONLY)
 		mnt_flags |= MNT_READONLY;
 
 	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 */
 	retval = kern_path(dir_name, LOOKUP_FOLLOW, &path);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 92734c0..5bc81c4 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -141,6 +141,7 @@ struct inodes_stat_t {
 #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_STRICTATIME	(1<<24) /* Always perform atime updates */
 #define MS_ACTIVE	(1<<30)
 #define MS_NOUSER	(1<<31)
 
diff --git a/include/linux/mount.h b/include/linux/mount.h
index cab2a85..51f55f9 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -27,6 +27,7 @@ struct mnt_namespace;
 #define MNT_NODIRATIME	0x10
 #define MNT_RELATIME	0x20
 #define MNT_READONLY	0x40	/* does the user want this to be r/o? */
+#define MNT_STRICTATIME 0x80
 
 #define MNT_SHRINKABLE	0x100
 #define MNT_IMBALANCED_WRITE_COUNT	0x200 /* just for debugging */

fs-relatime-make-default.patch:

--- NEW FILE fs-relatime-make-default.patch ---
From: Matthew Garrett <mjg at redhat.com>
Date: Thu, 26 Mar 2009 17:53:14 +0000 (+0000)
Subject: Make relatime default
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=0a1c01c9477602ee8b44548a9405b2c1d587b5a2

Make relatime default

Change the default behaviour of the kernel to use relatime for all
filesystems. This can be overridden with the "strictatime" mount
option.

Signed-off-by: Matthew Garrett <mjg at redhat.com>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---

diff --git a/fs/namespace.c b/fs/namespace.c
index d0659ec..f0e7530 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1920,6 +1920,9 @@ long do_mount(char *dev_name, char *dir_name, char *type_page,
 	if (data_page)
 		((char *)data_page)[PAGE_SIZE - 1] = 0;
 
+	/* Default to relatime */
+	mnt_flags |= MNT_RELATIME;
+
 	/* Separate the per-mountpoint flags */
 	if (flags & MS_NOSUID)
 		mnt_flags |= MNT_NOSUID;
@@ -1931,8 +1934,6 @@ long do_mount(char *dev_name, char *dir_name, char *type_page,
 		mnt_flags |= MNT_NOATIME;
 	if (flags & MS_NODIRATIME)
 		mnt_flags |= MNT_NODIRATIME;
-	if (flags & MS_RELATIME)
-		mnt_flags |= MNT_RELATIME;
 	if (flags & MS_STRICTATIME)
 		mnt_flags &= ~(MNT_RELATIME | MNT_NOATIME);
 	if (flags & MS_RDONLY)

fs-relatime-update-once-per-day.patch:

--- NEW FILE fs-relatime-update-once-per-day.patch ---
From: Matthew Garrett <mjg at redhat.com>
Date: Thu, 26 Mar 2009 17:32:14 +0000 (+0000)
Subject: Allow relatime to update atime once a day
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=11ff6f05f1e836a6a02369a4c4b64757e484adc1

Allow relatime to update atime once a day

Allow atime to be updated once per day even with relatime. This lets
utilities like tmpreaper (which delete files based on last access time)
continue working, making relatime a plausible default for distributions.

Signed-off-by: Matthew Garrett <mjg at redhat.com>
Reviewed-by: Matthew Wilcox <willy at linux.intel.com>
Acked-by: Valerie Aurora Henson <vaurora at redhat.com>
Acked-by: Alan Cox <alan at redhat.com>
Acked-by: Ingo Molnar <mingo at elte.hu>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---

diff --git a/fs/inode.c b/fs/inode.c
index 826fb0b..6ac0cef 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1290,6 +1290,40 @@ sector_t bmap(struct inode * inode, sector_t block)
 }
 EXPORT_SYMBOL(bmap);
 
+/*
+ * With relative atime, only update atime if the previous atime is
+ * earlier than either the ctime or mtime or if at least a day has
+ * passed since the last atime update.
+ */
+static int relatime_need_update(struct vfsmount *mnt, struct inode *inode,
+			     struct timespec now)
+{
+
+	if (!(mnt->mnt_flags & MNT_RELATIME))
+		return 1;
+	/*
+	 * Is mtime younger than atime? If yes, update atime:
+	 */
+	if (timespec_compare(&inode->i_mtime, &inode->i_atime) >= 0)
+		return 1;
+	/*
+	 * Is ctime younger than atime? If yes, update atime:
+	 */
+	if (timespec_compare(&inode->i_ctime, &inode->i_atime) >= 0)
+		return 1;
+
+	/*
+	 * Is the previous atime value older than a day? If yes,
+	 * update atime:
+	 */
+	if ((long)(now.tv_sec - inode->i_atime.tv_sec) >= 24*60*60)
+		return 1;
+	/*
+	 * Good, we can skip the atime update:
+	 */
+	return 0;
+}
+
 /**
  *	touch_atime	-	update the access time
  *	@mnt: mount the inode is accessed on
@@ -1317,17 +1351,12 @@ void touch_atime(struct vfsmount *mnt, struct dentry *dentry)
 		goto out;
 	if ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode))
 		goto out;
-	if (mnt->mnt_flags & MNT_RELATIME) {
-		/*
-		 * With relative atime, only update atime if the previous
-		 * atime is earlier than either the ctime or mtime.
-		 */
-		if (timespec_compare(&inode->i_mtime, &inode->i_atime) < 0 &&
-		    timespec_compare(&inode->i_ctime, &inode->i_atime) < 0)
-			goto out;
-	}
 
 	now = current_fs_time(inode->i_sb);
+
+	if (!relatime_need_update(mnt, inode, now))
+		goto out;
+
 	if (timespec_equal(&inode->i_atime, &now))
 		goto out;
 


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-10/kernel.spec,v
retrieving revision 1.1305
retrieving revision 1.1306
diff -u -r1.1305 -r1.1306
--- kernel.spec	25 Mar 2009 19:45:52 -0000	1.1305
+++ kernel.spec	26 Mar 2009 19:53:20 -0000	1.1306
@@ -662,6 +662,11 @@
 
 Patch2911: linux-2.6-ext4-flush-on-close.patch
 
+Patch2920: fs-relatime-add-strictatime-option.patch
+Patch2921: fs-relatime-update-once-per-day.patch
+# make relatime the default: do not apply this one yet
+Patch2922: fs-relatime-make-default.patch
+
 Patch9000: squashfs3.patch
 Patch9001: squashfs-fixups.patch
 
@@ -1089,6 +1094,11 @@
 #
 # bugfixes to drivers and filesystems
 #
+ApplyPatch fs-relatime-add-strictatime-option.patch
+ApplyPatch fs-relatime-update-once-per-day.patch
+# don't apply this one yet
+#ApplyPatch fs-relatime-make-default.patch
+
 
 # ext4
 # data integrity band-aid for badly written apps
@@ -1783,6 +1793,9 @@
 %kernel_variant_files -k vmlinux %{with_kdump} kdump
 
 %changelog
+* Wed Mar 26 2009 Chuck Ebbert <cebbert at redhat.com> 2.6.29-6
+- Add upstream relatime patches but don't make relatime the default.
+
 * Wed Mar 25 2009 Chuck Ebbert <cebbert at redhat.com> 2.6.29-5
 - Copy alsa-rewrite-hw_ptr-updaters.patch from F11:
   snd_pcm_update_hw_ptr() tries to detect the unexpected hwptr




More information about the fedora-extras-commits mailing list