[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1364807037-21664-2-git-send-email-dmonakhov@openvz.org>
Date: Mon, 1 Apr 2013 13:03:57 +0400
From: Dmitry Monakhov <dmonakhov@...nvz.org>
To: linux-ext4@...r.kernel.org
Cc: tytso@....edu, jack@...e.cz, Dmitry Monakhov <dmonakhov@...nvz.org>
Subject: [PATCH 2/2] ext4: optimize ext4_force_commit
We do not have to use jbd2_journal_force_commit() because it explicitly
start and stop SYNC transaction. This is very suboptimal because the only
users of ext4_force_commit() are ext4_sync_file and ext4_write_inode().
Both functions just want to commit and wait any uncommitted transaction
similar to ext4_sync_fs().
Signed-off-by: Dmitry Monakhov <dmonakhov@...nvz.org>
---
fs/ext4/super.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index e3e6a06..280a918 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4436,13 +4436,14 @@ static void ext4_clear_journal_err(struct super_block *sb,
*/
int ext4_force_commit(struct super_block *sb)
{
- journal_t *journal;
+ tid_t target;
if (sb->s_flags & MS_RDONLY)
return 0;
- journal = EXT4_SB(sb)->s_journal;
- return ext4_journal_force_commit(journal);
+ if (jbd2_journal_start_commit(EXT4_SB(sb)->s_journal, &target))
+ return jbd2_log_wait_commit(EXT4_SB(sb)->s_journal, target);
+ return 0;
}
static int ext4_sync_fs(struct super_block *sb, int wait)
@@ -4460,7 +4461,7 @@ static int ext4_sync_fs(struct super_block *sb, int wait)
dquot_writeback_dquots(sb, -1);
if (jbd2_journal_start_commit(sbi->s_journal, &target)) {
if (wait)
- jbd2_log_wait_commit(sbi->s_journal, target);
+ ret = jbd2_log_wait_commit(sbi->s_journal, target);
}
return ret;
}
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists