What's in ocfs2.git
Subsystems (4)
This e-mail describes the OCFS2 patches which I intend to push upstream to Linus for 2.6.20.
* Various ocfs2 cleanups, including a patchset by me intended to clean up some of the internal ocfs2 journal api. Mostly this revolves around removing the ocfs2_journal_handle wrapper around handle_t. The immediate benefits are better readability and a slightly smaller memory footprint for open journal transactions.
* Configfs gets some small cleanups and some mutex annotations.
* Atime updates - thanks to Tiger Yang <[email protected]>, ocfs2 now writes to the inode atime field. This doesn't require any disk changes, and is completely backwards compatible with older ocfs2 versions. An inodes Atime is only updated if it hasn't changed within a certain quantum. The user can define their own value at mount time, with 0 indicating that atime should always be updated. This is very similar to the scheme implemented by gfs2. In the future, I'd like to see a "relative atime" mode, which functions in the manner described by Valerie Henson at:
http://lkml.org/lkml/2006/8/25/380
* sys_splice - ocfs2 now has splice read and write support. Thanks again to Tiger for the bulk of this functionality. Mostly we make use of the generic_splice_read() and generic_file_splice_write_nolock() functions provided already in fs/splice.c.
- There is one patch in the ocfs2 splice() series external to fs/ocfs2 - a simple export of should_remove_suid(). This is done for code reuse purposes. That particular patch can be seen at:
I'll also attach it to this mail for review purposes.
* Last in the list of notable patches is a somewhat involved fix by Kurt Hackel <[email protected]> within the ocfs2 dlm. We had temporarily disable automatic migration of certain lock types because it was causing us problems during stress testing. This patch fixes those problems and re-enables migration. Overall this should reduce memory usage of the ocfs2 dlm.
The patches can be found in
git://git.kernel.org/pub/scm/linux/kernel/git/mfasheh/ocfs2.git upstream-linus
Additionally, broken out patches are available at:
Thanks,
--Mark
--
Mark Fasheh
Senior Software Developer, Oracle
[email protected]
[PATCH] Export should_remove_suid()
This helps us avoid replicating the same logic within file system drivers.
---
mm/filemap.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
d23a147bb6e8d467e8df73b6589888717da3b9ce
mm/filemap.c +1 -0
@@ -1893,6 +1893,7 @@ int should_remove_suid(struct dentry *dereturn 0 ; } +EXPORT_SYMBOL (should_remove_suid);int __remove_suid (struct dentry *dentry,int kill) {
Signature · 1 line
1.3.3
Hi,
Quoted 12 lines · Mark Fasheh
This e-mail describes the OCFS2 patches which I intend to push upstream to Linus for 2.6.20.
* Atime updates - thanks to Tiger Yang <[email protected]>, ocfs2 now writes to the inode atime field. This doesn't require any disk changes, and is completely backwards compatible with older ocfs2 versions. An inodes Atime is only updated if it hasn't changed within a certain quantum. The user can define their own value at mount time, with 0 indicating that atime should always be updated. This is very similar to the scheme implemented by gfs2. In the future, I'd like to see a "relative atime" mode, which functions in the manner described by Valerie Henson at:
Quoted 2 lines
I'd like to second that. [adding Val Henson to the "to"] What (if anything) remains to be done before the relative atime patch is ready to go upstream? I'm happy to help out here if required,
Steve.
Hi Steve,
Quoted 8 lines · Steven Whitehouse
Quoted 5 lines
In the future, I'd like to see a "relative atime" mode, which functions in the manner described by Valerie Henson at:
I'd like to second that. [adding Val Henson to the "to"] What (if anything) remains to be done before the relative atime patch is ready to go upstream? I'm happy to help out here if required,
Last time I looked at them, things seemed to be in pretty good shape - it wasn't a very large patch series.
The thing is (I'm going from memory here), gfs2 and ocfs2 are likely to just make use of the option parsing (and setting of the MNT_RELATIME flag), and ignore the changes to touch_atime() since we we handle our own atime updates.
Overall I think it's a matter of pushing the patches to the kernel and to mount(8). For ocfs2/gfs2 we implement a small amount of the logic in our "lock and update atime" functions.
--Mark
--
Mark Fasheh
Senior Software Developer, Oracle
[email protected]
Relative atime (was Re: What's in ocfs2.git)
Quoted 6 lines · Mark Fasheh
Hi Steve,
Quoted 3 lines · Steven Whitehouse
Quoted 3 lines
In the future, I'd like to see a "relative atime" mode, which functions in the manner described by Valerie Henson at:
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
I'd like to second that. [adding Val Henson to the "to"] What (if anything) remains to be done before the relative atime patch is ready to go upstream? I'm happy to help out here if required,
Last time I looked at them, things seemed to be in pretty good shape - it wasn't a very large patch series.
Yep, the relative atime patch is tiny and pretty much done - just needs some soak time in -mm and a little more review (cc'd Viro and fsdevel). Kernel patch against 2.6.18-rc4 appended, patch to mount following. (Note that my web server suffered a RAID failure and my patches page is unavailable till the restore finishes.)
-VAL
Add "relatime" (relative atime) support. 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.
--- fs/inode.c | 11 ++++++++++- fs/namespace.c | 5 ++++- include/linux/fs.h | 1 + include/linux/mount.h | 1 + 4 files changed, 16 insertions(+), 2 deletions(-)
fs/inode.c +10 -1
@@ -1200,7 +1200,16 @@ void touch_atime(struct vfsmount *mnt, sreturn ; now =current_fs_time (inode->i_sb); -if (!timespec_equal (&inode->i_atime, &now)) { +if (timespec_equal (&inode->i_atime, &now)) +return ; +/* +* With relative atime, only update atime if the previous +* atime is earlier than either the ctime or mtime. +*/ +if (!mnt || + !(mnt->mnt_flags &MNT_RELATIME ) || + (timespec_compare (&inode->i_atime, &inode->i_mtime) <0 ) || + (timespec_compare (&inode->i_atime, &inode->i_ctime) <0 )) { inode->i_atime = now;mark_inode_dirty_sync (inode); }
fs/namespace.c +4 -1
@@ -376,6 +376,7 @@ static int show_vfsmnt(struct seq_file * { MNT_NOEXEC, ",noexec" }, { MNT_NOATIME, ",noatime" }, { MNT_NODIRATIME, ",nodiratime" }, + { MNT_RELATIME, ",relatime" }, { 0, NULL } };struct proc_fs_info *fs_infop;
@@ -1413,9 +1414,11 @@ long do_mount(char *dev_name, char *dir_ mnt_flags |=MNT_NOATIME ;if (flags &MS_NODIRATIME ) mnt_flags |=MNT_NODIRATIME ; +if (flags &MS_RELATIME ) + mnt_flags |=MNT_RELATIME ; flags &= ~(MS_NOSUID |MS_NOEXEC |MS_NODEV |MS_ACTIVE | -MS_NOATIME |MS_NODIRATIME ); +MS_NOATIME |MS_NODIRATIME |MS_RELATIME );/* ... and get the mountpoint */ retval =path_lookup (dir_name,LOOKUP_FOLLOW , &nd);
include/linux/fs.h +1 -0
@@ -119,6 +119,7 @@ extern int dir_notify_enable;#define MS_PRIVATE (1<<18)/* change to private */ #define MS_SLAVE (1<<19)/* change to slave */ #define MS_SHARED (1<<20)/* change to shared */ +#define MS_RELATIME (1<<21)/* Update atime relative to mtime/ctime. */ #define MS_ACTIVE (1<<30)#define MS_NOUSER (1<<31)
include/linux/mount.h +1 -0
@@ -27,6 +27,7 @@ struct namespace;#define MNT_NOEXEC 0x04#define MNT_NOATIME 0x08#define MNT_NODIRATIME 0x10 +#define MNT_RELATIME 0x20#define MNT_SHRINKABLE 0x100
Re: Relative atime (was Re: What's in ocfs2.git)
Quoted 7 lines · Valerie Henson
Quoted 6 lines · Mark Fasheh
Hi Steve,
Quoted 3 lines · Steven Whitehouse
Quoted 3 lines
In the future, I'd like to see a "relative atime" mode, which functions in the manner described by Valerie Henson at:
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
I'd like to second that. [adding Val Henson to the "to"] What (if anything) remains to be done before the relative atime patch is ready to go upstream? I'm happy to help out here if required,
Last time I looked at them, things seemed to be in pretty good shape - it wasn't a very large patch series.
And the userland part.
-VAL
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.
--- mount/mount.8 | 7 +++++++ mount/mount.c | 6 ++++++ mount/mount_constants.h | 4 ++++ 3 files changed, 17 insertions(+)
mount/mount.8 +7 -0
@@ -586,6 +586,13 @@ access on the news spool to speed up new .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
mount/mount.c +6 -0
@@ -164,6 +164,12 @@ static const struct opt_map opt_map[] = { "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 } };
mount/mount_constants.h +4 -0
@@ -57,6 +57,10 @@ if we have a stack or plain mount - moun#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 /* * Magic mount flag number. Had to be or-ed to the flag values. */
Re: Relative atime (was Re: What's in ocfs2.git)
In reply to Valerie HensonQuoted 8 lines · Valerie Henson
Quoted 2 lines
Last time I looked at them, things seemed to be in pretty good shape - it wasn't a very large patch series.
Yep, the relative atime patch is tiny and pretty much done - just needs some soak time in -mm and a little more review (cc'd Viro and fsdevel). Kernel patch against 2.6.18-rc4 appended, patch to mount following. (Note that my web server suffered a RAID failure and my patches page is unavailable till the restore finishes.)
Well, here's what the ocfs2 patch would look like. If we care to push this forward, some time in -mm would be nice...
--Mark
From: Mark Fasheh <[email protected]>
Date: Tue, 5 Dec 2006 14:13:41 -0800
Subject: [PATCH] ocfs2: relative atime support
Update ocfs2_should_update_atime() to understand the MNT_RELATIME flag and to test against mtime / ctime accordingly.
--- fs/ocfs2/file.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
fs/ocfs2/file.c +9 -0
@@ -154,6 +154,15 @@ int ocfs2_should_update_atime(struct inoreturn 0 ; now =CURRENT_TIME ; + +if (vfsmnt->mnt_flags &MNT_RELATIME ) { +if ((timespec_compare (&inode->i_atime, &inode->i_mtime) <0 ) || + (timespec_compare (&inode->i_atime, &inode->i_ctime) <0 )) +return 1 ; + +return 0 ; + } +if ((now.tv_sec - inode->i_atime.tv_sec <= osb->s_atime_quantum))return 0 ;else
Signature · 1 line
1.4.2.4
Re: Relative atime (was Re: What's in ocfs2.git)
Quoted 8 lines · On Tue, 5 Dec 2006 14:20:27 -0800 Mark Fasheh <[email protected]> wrote:
Update
ocfs2_should_update_atime()to understand theMNT_RELATIMEflag and to test against mtime / ctime accordingly....
fs/ocfs2/file.c int ocfs2_should_update_atime(struct ino · line 163
Quoted 10 lines
fs/ocfs2/file.c +7
-0@@ -154,6 +154,15 @@ int ocfs2_should_update_atime(struct inoreturn 0 ; now =CURRENT_TIME ; + +if (vfsmnt->mnt_flags &MNT_RELATIME ) { +if ((timespec_compare (&inode->i_atime, &inode->i_mtime) <0 ) || + (timespec_compare (&inode->i_atime, &inode->i_ctime) <0 )) +return 1 ; + +return 0 ;
So if atime == mtime == ctime, we don't update the atime.
I think we should. It seems risky to leave them all equal.
Re: Relative atime (was Re: What's in ocfs2.git)
In reply to Valerie HensonQuoted 5 lines · On Mon, 4 Dec 2006 16:36:20 -0800 Valerie Henson <[email protected]>…
Add "relatime" (relative atime) support. 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.
That seems like a good idea.
I found touch_atime() to be rather putrid, so I hacked it around a bit. The end result:
void touch_atime(struct vfsmount *mnt, struct dentry *dentry)
{
struct inode *inode = dentry->d_inode;
struct timespec now;
if (IS_RDONLY(inode))
return;
if (inode->i_flags & S_NOATIME)
return;
if (inode->i_sb->s_flags & MS_NOATIME)
return;
if ((inode->i_sb->s_flags & MS_NODIRATIME) && S_ISDIR(inode->i_mode))
return;
/*
* We may have a NULL vfsmount when coming from NFSD
*/
if (mnt) {
if (mnt->mnt_flags & MNT_NOATIME)
return;
if ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode))
return;
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)
return;
}
}
now = current_fs_time(inode->i_sb);
if (timespec_equal(&inode->i_atime, &now))
return;
inode->i_atime = now;
mark_inode_dirty_sync(inode);
}Does it still look right?
Note the reordering to avoid the current_fs_time() call if poss.
That's the easy part. How are we going to get mount(8) patched?
Re: Relative atime (was Re: What's in ocfs2.git)
Quoted 10 lines · Andrew Morton
Quoted 5 lines · On Mon, 4 Dec 2006 16:36:20 -0800 Valerie Henson <[email protected]>…
Add "relatime" (relative atime) support. 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.
That seems like a good idea.
I found
touch_atime()to be rather putrid, so I hacked it around a bit. The end result:
I like that rather better - add my:
Quoted 1 line
That's the easy part. How are we going to get mount(8) patched?
Well, the nodiratime documentation got in. (I was going to add that as part of this apatch, but lo and behold.)
-VAL
Re: Relative atime (was Re: What's in ocfs2.git)
In reply to Andrew MortonQuoted 10 lines · Andrew Morton
Quoted 6 lines
On Mon, 4 Dec 2006 16:36:20 -0800 Valerie Henson <[email protected]> wrote: Add "relatime" (relative atime) support. 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.
That seems like a good idea.
I found
touch_atime()to be rather putrid, so I hacked it around a bit.
I find this function full of tests...
Quoted 9 lines
The end result:
void
touch_atime(struct vfsmount *mnt, struct dentry *dentry){ struct inode *inode = dentry->d_inode; struct timespec now; if (IS_RDONLY(inode)) return;
While we are adding new tests, we could try to be smart here testing both MS_RDONLY and MS_NOATIME.
if (__IS_FLG(inode, MS_RDONLY | MS_NOATIME))
return;
Quoted 5 lines
if (inode->i_flags & S_NOATIME) return; if (inode->i_sb->s_flags & MS_NOATIME) return;
So that that one can be deleted.
Quoted 2 lines
if ((
inode->i_sb->s_flags&MS_NODIRATIME) &&S_ISDIR(inode->i_mode)) return;
if (__IS_FLG(inode, MS_NODIRATIME) && S_ISDIR(inode->i_mode)) return;
Eric
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Relative atime (was Re: What's in ocfs2.git)
Quoted 6 lines
Quoted 5 lines
if (inode->i_sb->s_flags & MS_NOATIME) return;So that that one can be deleted.
Hi,
I would mostly expect the compiler to be relatively smart about this and group a bunch of these tests together... so I rather see readable code than optimized code for something the compiler should be doing for us ;)
Greetings,
Arjan van de Ven
Re: Relative atime (was Re: What's in ocfs2.git)
In reply to Andrew MortonQuoted 1 line · Andrew Morton
That's the easy part. How are we going to get mount(8) patched?
Karel, interested in taking a look at the following patch? The kernel bits are in -mm currently.
-VAL
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.
--- mount/mount.8 | 7 +++++++ mount/mount.c | 6 ++++++ mount/mount_constants.h | 4 ++++ 3 files changed, 17 insertions(+)
mount/mount.8 +7 -0
@@ -586,6 +586,13 @@ access on the news spool to speed up new .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
mount/mount.c +6 -0
@@ -164,6 +164,12 @@ static const struct opt_map opt_map[] = { "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 } };
mount/mount_constants.h +4 -0
@@ -57,6 +57,10 @@ if we have a stack or plain mount - moun#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 /* * Magic mount flag number. Had to be or-ed to the flag values. */
Re: Relative atime (was Re: What's in ocfs2.git)
Quoted 5 lines · Valerie Henson
Quoted 1 line · Andrew Morton
That's the easy part. How are we going to get mount(8) patched?
Karel, interested in taking a look at the following patch? The kernel bits are in -mm currently.
The patch looks good. I'll add it to my development util-linux tree. Thanks.
Karel
Quoted 66 lines
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.
Signed-off-by Valerie Henson <[email protected]>--- mount/mount.8 | 7 +++++++ mount/mount.c | 6 ++++++ mount/mount_constants.h | 4 ++++ 3 files changed, 17 insertions(+)mount/mount.8 +7
-0@@ -586,6 +586,13 @@ access on the news spool to speed up new .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 \-amount/mount.c +6
-0@@ -164,6 +164,12 @@ static const struct opt_map opt_map[] = { "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 } };mount/mount_constants.h +4
-1@@ -57,6 +57,10 @@ if we have a stack or plain mount - moun#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 /* * Magic mount flag number. Had to be or-ed to the flag values. */ -To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 1 line
Karel Zak <[email protected]>