Skip to content

Commit ac1334b

Browse files
Kazuya Miojankara
authored andcommitted
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>
1 parent 053800a commit ac1334b

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎fs/ext3/inode.c‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,7 @@ static int ext3_splice_branch(handle_t *handle, struct inode *inode,
756756
struct ext3_block_alloc_info *block_i;
757757
ext3_fsblk_t current_block;
758758
struct ext3_inode_info *ei = EXT3_I(inode);
759+
struct timespec now;
759760

760761
block_i = ei->i_block_alloc_info;
761762
/*
@@ -795,9 +796,11 @@ static int ext3_splice_branch(handle_t *handle, struct inode *inode,
795796
}
796797

797798
/* We are done with atomic stuff, now do the rest of housekeeping */
798-
799-
inode->i_ctime = CURRENT_TIME_SEC;
800-
ext3_mark_inode_dirty(handle, inode);
799+
now = CURRENT_TIME_SEC;
800+
if (!timespec_equal(&inode->i_ctime, &now) || !where->bh) {
801+
inode->i_ctime = now;
802+
ext3_mark_inode_dirty(handle, inode);
803+
}
801804
/* ext3_mark_inode_dirty already updated i_sync_tid */
802805
atomic_set(&ei->i_datasync_tid, handle->h_transaction->t_tid);
803806

0 commit comments

Comments
 (0)