From: Alex Tomas <bzzz@tmi.comex.ru>

start_this_handle() takes into account t_outstanding_credits when calculating
log free space, but journal_next_log_block() accounts for blocks being logged
also.  Hence, blocks are accounting twice.  This effectively reduces the
amount of log space available to transactions and forces more commits.

Fix it by decrementing t_outstanding_credits each time we allocate a new
journal block.




 25-akpm/fs/jbd/commit.c |    7 +++++++
 fs/jbd/checkpoint.c     |    0 
 fs/jbd/transaction.c    |    0 
 include/linux/jbd.h     |    0 
 4 files changed, 7 insertions(+)

diff -puN fs/jbd/commit.c~jbd-dont-account-blocks-twice fs/jbd/commit.c
--- 25/fs/jbd/commit.c~jbd-dont-account-blocks-twice	Tue Jul  8 09:43:16 2003
+++ 25-akpm/fs/jbd/commit.c	Tue Jul  8 09:43:16 2003
@@ -401,6 +401,13 @@ sync_datalist_empty:
 			continue;
 		}
 
+		/*
+		 * start_this_handle() uses t_outstanding_credits to determine
+		 * the free space in the log, but this counter is changed
+		 * by journal_next_log_block() also.
+		 */
+		commit_transaction->t_outstanding_credits--;
+
 		/* Bump b_count to prevent truncate from stumbling over
                    the shadowed buffer!  @@@ This can go if we ever get
                    rid of the BJ_IO/BJ_Shadow pairing of buffers. */
diff -puN fs/jbd/checkpoint.c~jbd-dont-account-blocks-twice fs/jbd/checkpoint.c
diff -puN fs/jbd/transaction.c~jbd-dont-account-blocks-twice fs/jbd/transaction.c
diff -puN include/linux/jbd.h~jbd-dont-account-blocks-twice include/linux/jbd.h

_