Commit f0f46afd authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] ext3_mark_inode_dirty() speedup

ext3_mark_inode_dirty() (and several other callers) use the
ext3_reserve_inode_write() and ext3_mark_ioc_dirty() pair for journalling an
inode's backing block.

Because ext3_reserve_inode_write() gets journalling access to the block there
is no need for ext3_mark_iloc_dirty() to do it as well.

This change reduces the overhead of a write() from 2.7 microseconds to 1.95
on a 2.7G P4.
parent 7ba93ca7
......@@ -2355,8 +2355,9 @@ void ext3_read_inode(struct inode * inode)
* Post the struct inode info into an on-disk inode location in the
* buffer-cache. This gobbles the caller's reference to the
* buffer_head in the inode location struct.
*
* The caller must have write access to iloc->bh.
*/
static int ext3_do_update_inode(handle_t *handle,
struct inode *inode,
struct ext3_iloc *iloc)
......@@ -2366,12 +2367,6 @@ static int ext3_do_update_inode(handle_t *handle,
struct buffer_head *bh = iloc->bh;
int err = 0, rc, block;
if (handle) {
BUFFER_TRACE(bh, "get_write_access");
err = ext3_journal_get_write_access(handle, bh);
if (err)
goto out_brelse;
}
/* For fields not not tracking in the in-memory inode,
* initialise them to zero for new inodes. */
if (ei->i_state & EXT3_STATE_NEW)
......@@ -2633,22 +2628,21 @@ int ext3_writepage_trans_blocks(struct inode *inode)
return ret;
}
int
ext3_mark_iloc_dirty(handle_t *handle,
struct inode *inode,
struct ext3_iloc *iloc)
/*
* The caller must have previously called ext3_reserve_inode_write().
* Give this, we know that the caller already has write access to iloc->bh.
*/
int ext3_mark_iloc_dirty(handle_t *handle,
struct inode *inode, struct ext3_iloc *iloc)
{
int err = 0;
if (handle) {
/* the do_update_inode consumes one bh->b_count */
atomic_inc(&iloc->bh->b_count);
err = ext3_do_update_inode(handle, inode, iloc);
get_bh(iloc->bh);
/* ext3_do_update_inode() does journal_dirty_metadata */
brelse(iloc->bh);
} else {
printk(KERN_EMERG "%s: called with no handle!\n", __FUNCTION__);
}
err = ext3_do_update_inode(handle, inode, iloc);
put_bh(iloc->bh);
return err;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment