diff options
author | Kazuya Mio <k-mio@sx.jp.nec.com> | 2012-02-08 02:34:29 -0500 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2012-02-29 15:53:46 -0500 |
commit | ac1334bfdae33be17ae6ae641bbbd1e6a2f04005 (patch) | |
tree | 1d7beae4467acc1ba18a90d18b07eab5563c14de /fs/ext3 | |
parent | 053800a84b942511054b51299db4430b3d1b06bc (diff) |
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>
Diffstat (limited to 'fs/ext3')
-rw-r--r-- | fs/ext3/inode.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index 2d0afeca0b47..6d3418662b54 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c | |||
@@ -756,6 +756,7 @@ static int ext3_splice_branch(handle_t *handle, struct inode *inode, | |||
756 | struct ext3_block_alloc_info *block_i; | 756 | struct ext3_block_alloc_info *block_i; |
757 | ext3_fsblk_t current_block; | 757 | ext3_fsblk_t current_block; |
758 | struct ext3_inode_info *ei = EXT3_I(inode); | 758 | struct ext3_inode_info *ei = EXT3_I(inode); |
759 | struct timespec now; | ||
759 | 760 | ||
760 | block_i = ei->i_block_alloc_info; | 761 | block_i = ei->i_block_alloc_info; |
761 | /* | 762 | /* |
@@ -795,9 +796,11 @@ static int ext3_splice_branch(handle_t *handle, struct inode *inode, | |||
795 | } | 796 | } |
796 | 797 | ||
797 | /* We are done with atomic stuff, now do the rest of housekeeping */ | 798 | /* We are done with atomic stuff, now do the rest of housekeeping */ |
798 | 799 | now = CURRENT_TIME_SEC; | |
799 | inode->i_ctime = CURRENT_TIME_SEC; | 800 | if (!timespec_equal(&inode->i_ctime, &now) || !where->bh) { |
800 | ext3_mark_inode_dirty(handle, inode); | 801 | inode->i_ctime = now; |
802 | ext3_mark_inode_dirty(handle, inode); | ||
803 | } | ||
801 | /* ext3_mark_inode_dirty already updated i_sync_tid */ | 804 | /* ext3_mark_inode_dirty already updated i_sync_tid */ |
802 | atomic_set(&ei->i_datasync_tid, handle->h_transaction->t_tid); | 805 | atomic_set(&ei->i_datasync_tid, handle->h_transaction->t_tid); |
803 | 806 | ||