Skip to content

Commit ed97bd3

Browse files
Andreas MohrLinus Torvalds
authored andcommitted
[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>
1 parent 07acaf2 commit ed97bd3

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

‎fs/inode.c‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ static struct inode * get_new_inode_fast(struct super_block *sb, struct hlist_he
657657
return inode;
658658
}
659659

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)
661661
{
662662
unsigned long tmp;
663663

@@ -1003,7 +1003,7 @@ void generic_delete_inode(struct inode *inode)
10031003

10041004
list_del_init(&inode->i_list);
10051005
list_del_init(&inode->i_sb_list);
1006-
inode->i_state|=I_FREEING;
1006+
inode->i_state |= I_FREEING;
10071007
inodes_stat.nr_inodes--;
10081008
spin_unlock(&inode_lock);
10091009

@@ -1210,13 +1210,15 @@ void file_update_time(struct file *file)
12101210
return;
12111211

12121212
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;
12141215
sync_it = 1;
1215-
inode->i_mtime = now;
1216+
}
12161217

1217-
if (!timespec_equal(&inode->i_ctime, &now))
1218+
if (!timespec_equal(&inode->i_ctime, &now)) {
1219+
inode->i_ctime = now;
12181220
sync_it = 1;
1219-
inode->i_ctime = now;
1221+
}
12201222

12211223
if (sync_it)
12221224
mark_inode_dirty_sync(inode);

0 commit comments

Comments
 (0)