aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorFrank Mayhar <fmayhar@google.com>2009-09-29 10:07:47 -0400
committerTheodore Ts'o <tytso@mit.edu>2009-09-29 10:07:47 -0400
commit830156c79b0a99ddf0f62496bcf4de640f9f52cd (patch)
tree7af8e969f359afd8a4738e22b0374b567041a1fd /fs
parentf3ce8064b388ccf420012c5a4907aae4f13fe9d0 (diff)
ext4: Avoid updating the inode table bh twice in no journal mode
This is a cleanup of commit 91ac6f4. Since ext4_mark_inode_dirty() has already called ext4_mark_iloc_dirty(), which in turn calls ext4_do_update_inode(), it's not necessary to have ext4_write_inode() call ext4_do_update_inode() in no journal mode. Indeed, it would be duplicated work. Reviewed-by: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Frank Mayhar <fmayhar@google.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/inode.c37
1 files changed, 16 insertions, 21 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 118e16ca91d7..22fb1a3a045c 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4991,8 +4991,7 @@ static int ext4_inode_blocks_set(handle_t *handle,
4991 */ 4991 */
4992static int ext4_do_update_inode(handle_t *handle, 4992static int ext4_do_update_inode(handle_t *handle,
4993 struct inode *inode, 4993 struct inode *inode,
4994 struct ext4_iloc *iloc, 4994 struct ext4_iloc *iloc)
4995 int do_sync)
4996{ 4995{
4997 struct ext4_inode *raw_inode = ext4_raw_inode(iloc); 4996 struct ext4_inode *raw_inode = ext4_raw_inode(iloc);
4998 struct ext4_inode_info *ei = EXT4_I(inode); 4997 struct ext4_inode_info *ei = EXT4_I(inode);
@@ -5093,22 +5092,10 @@ static int ext4_do_update_inode(handle_t *handle,
5093 raw_inode->i_extra_isize = cpu_to_le16(ei->i_extra_isize); 5092 raw_inode->i_extra_isize = cpu_to_le16(ei->i_extra_isize);
5094 } 5093 }
5095 5094
5096 /* 5095 BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata");
5097 * If we're not using a journal and we were called from 5096 rc = ext4_handle_dirty_metadata(handle, inode, bh);
5098 * ext4_write_inode() to sync the inode (making do_sync true), 5097 if (!err)
5099 * we can just use sync_dirty_buffer() directly to do our dirty 5098 err = rc;
5100 * work. Testing s_journal here is a bit redundant but it's
5101 * worth it to avoid potential future trouble.
5102 */
5103 if (EXT4_SB(inode->i_sb)->s_journal == NULL && do_sync) {
5104 BUFFER_TRACE(bh, "call sync_dirty_buffer");
5105 sync_dirty_buffer(bh);
5106 } else {
5107 BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata");
5108 rc = ext4_handle_dirty_metadata(handle, inode, bh);
5109 if (!err)
5110 err = rc;
5111 }
5112 ei->i_state &= ~EXT4_STATE_NEW; 5099 ei->i_state &= ~EXT4_STATE_NEW;
5113 5100
5114out_brelse: 5101out_brelse:
@@ -5176,8 +5163,16 @@ int ext4_write_inode(struct inode *inode, int wait)
5176 err = ext4_get_inode_loc(inode, &iloc); 5163 err = ext4_get_inode_loc(inode, &iloc);
5177 if (err) 5164 if (err)
5178 return err; 5165 return err;
5179 err = ext4_do_update_inode(EXT4_NOJOURNAL_HANDLE, 5166 if (wait)
5180 inode, &iloc, wait); 5167 sync_dirty_buffer(iloc.bh);
5168 if (buffer_req(iloc.bh) && !buffer_uptodate(iloc.bh)) {
5169 ext4_error(inode->i_sb, __func__,
5170 "IO error syncing inode, "
5171 "inode=%lu, block=%llu",
5172 inode->i_ino,
5173 (unsigned long long)iloc.bh->b_blocknr);
5174 err = -EIO;
5175 }
5181 } 5176 }
5182 return err; 5177 return err;
5183} 5178}
@@ -5473,7 +5468,7 @@ int ext4_mark_iloc_dirty(handle_t *handle,
5473 get_bh(iloc->bh); 5468 get_bh(iloc->bh);
5474 5469
5475 /* ext4_do_update_inode() does jbd2_journal_dirty_metadata */ 5470 /* ext4_do_update_inode() does jbd2_journal_dirty_metadata */
5476 err = ext4_do_update_inode(handle, inode, iloc, 0); 5471 err = ext4_do_update_inode(handle, inode, iloc);
5477 put_bh(iloc->bh); 5472 put_bh(iloc->bh);
5478 return err; 5473 return err;
5479} 5474}