Skip to content

Commit

Permalink
ext3: Update ctime in ext3_splice_branch() only when needed
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kazuya Mio authored and jankara committed Feb 29, 2012
1 parent 053800a commit ac1334b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions fs/ext3/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,7 @@ static int ext3_splice_branch(handle_t *handle, struct inode *inode,
struct ext3_block_alloc_info *block_i;
ext3_fsblk_t current_block;
struct ext3_inode_info *ei = EXT3_I(inode);
struct timespec now;

block_i = ei->i_block_alloc_info;
/*
Expand Down Expand Up @@ -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 */

inode->i_ctime = CURRENT_TIME_SEC;
ext3_mark_inode_dirty(handle, inode);
now = CURRENT_TIME_SEC;
if (!timespec_equal(&inode->i_ctime, &now) || !where->bh) {
inode->i_ctime = now;
ext3_mark_inode_dirty(handle, inode);
}
/* ext3_mark_inode_dirty already updated i_sync_tid */
atomic_set(&ei->i_datasync_tid, handle->h_transaction->t_tid);

Expand Down

0 comments on commit ac1334b

Please sign in to comment.