summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Mohr <andi@rhlx01.fht-esslingen.de>2006-10-02 02:17:17 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-02 07:57:14 -0700
commited97bd37efd8ff7398d3a7eedf4bcbf245f5dad3 (patch)
tree79817438dc5b3e004ba91d593228dc8aefcda3e8
parent07acaf28d21e710bcf1cec91c0cfdb1a7b5e3d65 (diff)
downloadlinux-3.10-ed97bd37efd8ff7398d3a7eedf4bcbf245f5dad3.tar.gz
linux-3.10-ed97bd37efd8ff7398d3a7eedf4bcbf245f5dad3.tar.bz2
linux-3.10-ed97bd37efd8ff7398d3a7eedf4bcbf245f5dad3.zip
[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>
-rw-r--r--fs/inode.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/inode.c b/fs/inode.c
index ada7643104e..bf6bec4e54f 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
return inode;
}
-static inline unsigned long hash(struct super_block *sb, unsigned long hashval)
+static unsigned long hash(struct super_block *sb, unsigned long hashval)
{
unsigned long tmp;
@@ -1003,7 +1003,7 @@ void generic_delete_inode(struct inode *inode)
list_del_init(&inode->i_list);
list_del_init(&inode->i_sb_list);
- inode->i_state|=I_FREEING;
+ inode->i_state |= I_FREEING;
inodes_stat.nr_inodes--;
spin_unlock(&inode_lock);
@@ -1210,13 +1210,15 @@ void file_update_time(struct file *file)
return;
now = current_fs_time(inode->i_sb);
- if (!timespec_equal(&inode->i_mtime, &now))
+ if (!timespec_equal(&inode->i_mtime, &now)) {
+ inode->i_mtime = now;
sync_it = 1;
- inode->i_mtime = now;
+ }
- if (!timespec_equal(&inode->i_ctime, &now))
+ if (!timespec_equal(&inode->i_ctime, &now)) {
+ inode->i_ctime = now;
sync_it = 1;
- inode->i_ctime = now;
+ }
if (sync_it)
mark_inode_dirty_sync(inode);