diff options
author | Andreas Mohr <andi@rhlx01.fht-esslingen.de> | 2006-10-02 05:17:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-02 10:57:14 -0400 |
commit | ed97bd37efd8ff7398d3a7eedf4bcbf245f5dad3 (patch) | |
tree | 79817438dc5b3e004ba91d593228dc8aefcda3e8 /fs | |
parent | 07acaf28d21e710bcf1cec91c0cfdb1a7b5e3d65 (diff) |
[PATCH] fs/inode.c tweaks
Only touch inode's i_mtime and i_ctime to make them equal to "now" in case
they aren't yet (don't just update timestamp unconditionally). Uninline
the hash function to save 259 Bytes.
This tiny inode change which may improve cache behaviour also shaves off 8
Bytes from file_update_time() on i386.
Included a tiny codestyle cleanup, too.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/inode.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/inode.c b/fs/inode.c index ada7643104e1..bf6bec4e54ff 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -657,7 +657,7 @@ static struct inode * get_new_inode_fast(struct super_block *sb, struct hlist_he | |||
657 | return inode; | 657 | return inode; |
658 | } | 658 | } |
659 | 659 | ||
660 | static inline unsigned long hash(struct super_block *sb, unsigned long hashval) | 660 | static unsigned long hash(struct super_block *sb, unsigned long hashval) |
661 | { | 661 | { |
662 | unsigned long tmp; | 662 | unsigned long tmp; |
663 | 663 | ||
@@ -1003,7 +1003,7 @@ void generic_delete_inode(struct inode *inode) | |||
1003 | 1003 | ||
1004 | list_del_init(&inode->i_list); | 1004 | list_del_init(&inode->i_list); |
1005 | list_del_init(&inode->i_sb_list); | 1005 | list_del_init(&inode->i_sb_list); |
1006 | inode->i_state|=I_FREEING; | 1006 | inode->i_state |= I_FREEING; |
1007 | inodes_stat.nr_inodes--; | 1007 | inodes_stat.nr_inodes--; |
1008 | spin_unlock(&inode_lock); | 1008 | spin_unlock(&inode_lock); |
1009 | 1009 | ||
@@ -1210,13 +1210,15 @@ void file_update_time(struct file *file) | |||
1210 | return; | 1210 | return; |
1211 | 1211 | ||
1212 | now = current_fs_time(inode->i_sb); | 1212 | now = current_fs_time(inode->i_sb); |
1213 | if (!timespec_equal(&inode->i_mtime, &now)) | 1213 | if (!timespec_equal(&inode->i_mtime, &now)) { |
1214 | inode->i_mtime = now; | ||
1214 | sync_it = 1; | 1215 | sync_it = 1; |
1215 | inode->i_mtime = now; | 1216 | } |
1216 | 1217 | ||
1217 | if (!timespec_equal(&inode->i_ctime, &now)) | 1218 | if (!timespec_equal(&inode->i_ctime, &now)) { |
1219 | inode->i_ctime = now; | ||
1218 | sync_it = 1; | 1220 | sync_it = 1; |
1219 | inode->i_ctime = now; | 1221 | } |
1220 | 1222 | ||
1221 | if (sync_it) | 1223 | if (sync_it) |
1222 | mark_inode_dirty_sync(inode); | 1224 | mark_inode_dirty_sync(inode); |