Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ext3: Update ctime in ext3_splice_branch() only when needed

Currently ext3 updates ctime in ext3_splice_branch() which is called whenever
we allocate one block. But it is wasteful because ext3 doesn't support
nanosecond timestamp. This leads to a performance loss.

Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
Signed-off-by: Jan Kara <jack@suse.cz>

authored by

Kazuya Mio and committed by
Jan Kara
ac1334bf 053800a8

+6 -3
+6 -3
fs/ext3/inode.c
··· 756 756 struct ext3_block_alloc_info *block_i; 757 757 ext3_fsblk_t current_block; 758 758 struct ext3_inode_info *ei = EXT3_I(inode); 759 + struct timespec now; 759 760 760 761 block_i = ei->i_block_alloc_info; 761 762 /* ··· 796 795 } 797 796 798 797 /* We are done with atomic stuff, now do the rest of housekeeping */ 799 - 800 - inode->i_ctime = CURRENT_TIME_SEC; 801 - ext3_mark_inode_dirty(handle, inode); 798 + now = CURRENT_TIME_SEC; 799 + if (!timespec_equal(&inode->i_ctime, &now) || !where->bh) { 800 + inode->i_ctime = now; 801 + ext3_mark_inode_dirty(handle, inode); 802 + } 802 803 /* ext3_mark_inode_dirty already updated i_sync_tid */ 803 804 atomic_set(&ei->i_datasync_tid, handle->h_transaction->t_tid); 804 805