提交 ac1334bf 编写于 作者: K Kazuya Mio 提交者: Jan Kara

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: NKazuya Mio <k-mio@sx.jp.nec.com>
Signed-off-by: NJan Kara <jack@suse.cz>
上级 053800a8
...@@ -756,6 +756,7 @@ static int ext3_splice_branch(handle_t *handle, struct inode *inode, ...@@ -756,6 +756,7 @@ static int ext3_splice_branch(handle_t *handle, struct inode *inode,
struct ext3_block_alloc_info *block_i; struct ext3_block_alloc_info *block_i;
ext3_fsblk_t current_block; ext3_fsblk_t current_block;
struct ext3_inode_info *ei = EXT3_I(inode); struct ext3_inode_info *ei = EXT3_I(inode);
struct timespec now;
block_i = ei->i_block_alloc_info; block_i = ei->i_block_alloc_info;
/* /*
...@@ -795,9 +796,11 @@ static int ext3_splice_branch(handle_t *handle, struct inode *inode, ...@@ -795,9 +796,11 @@ static int ext3_splice_branch(handle_t *handle, struct inode *inode,
} }
/* We are done with atomic stuff, now do the rest of housekeeping */ /* We are done with atomic stuff, now do the rest of housekeeping */
now = CURRENT_TIME_SEC;
inode->i_ctime = CURRENT_TIME_SEC; if (!timespec_equal(&inode->i_ctime, &now) || !where->bh) {
ext3_mark_inode_dirty(handle, inode); inode->i_ctime = now;
ext3_mark_inode_dirty(handle, inode);
}
/* ext3_mark_inode_dirty already updated i_sync_tid */ /* ext3_mark_inode_dirty already updated i_sync_tid */
atomic_set(&ei->i_datasync_tid, handle->h_transaction->t_tid); atomic_set(&ei->i_datasync_tid, handle->h_transaction->t_tid);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册