[PATCH] jbd2: Skip commit of a transaction without any buffers

From: Jan Kara
Date: Thu Dec 18 2008 - 19:20:47 EST


Signed-off-by: Jan Kara <jack@xxxxxxx>
---
fs/jbd2/commit.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
index ebc667b..798e021 100644
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/commit.c
@@ -401,6 +401,21 @@ void jbd2_journal_commit_transaction(journal_t *journal)
J_ASSERT (commit_transaction->t_outstanding_credits <=
journal->j_max_transaction_buffers);

+ /* Skip commit of a transaction without any buffers */
+ spin_lock(&journal->j_list_lock);
+ if (commit_transaction->t_reserved_list == NULL &&
+ commit_transaction->t_buffers == NULL &&
+ commit_transaction->t_forget == NULL &&
+ list_empty(commit_transaction->t_inode_list)) {
+ BUG_ON(commit_transaction->t_checkpoint_list);
+ BUG_ON(commit_transaction->t_checkpoint_io_list);
+ BUG_ON(commit_transaction->t_iobuf_list);
+ BUG_ON(commit_transaction->t_shadow_list);
+ BUG_ON(commit_transaction->t_log_list);
+ goto out_committed;
+ }
+ spin_unlock(&journal->j_list_lock);
+
/*
* First thing we are allowed to do is to discard any remaining
* BJ_Reserved buffers. Note, it is _not_ permissible to assume
@@ -934,6 +949,7 @@ restart_loop:

/* Done with this transaction! */

+out_committed:
jbd_debug(3, "JBD: commit phase 7\n");

J_ASSERT(commit_transaction->t_state == T_COMMIT);
--
1.6.0.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/