From 4156b32e15554a4679f7b4094666b8392580eb3f Mon Sep 17 00:00:00 2001
From: alex <alex>
Date: Thu, 10 Mar 2005 22:13:14 +0000
Subject: [PATCH] b=5209

  __journal_refile_buffer() shouldn't file buffer
  on metadata list if the buffer is clean
---
 .../patches/jbd-buffer-release-2.6.7.patch    | 31 ++++++++++++-------
 1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/lustre/kernel_patches/patches/jbd-buffer-release-2.6.7.patch b/lustre/kernel_patches/patches/jbd-buffer-release-2.6.7.patch
index b4708d82e9..d066220e62 100644
--- a/lustre/kernel_patches/patches/jbd-buffer-release-2.6.7.patch
+++ b/lustre/kernel_patches/patches/jbd-buffer-release-2.6.7.patch
@@ -106,7 +106,7 @@ Index: linux-2.6.7/include/linux/jbd.h
 Index: linux-2.6.7/fs/jbd/transaction.c
 ===================================================================
 --- linux-2.6.7.orig/fs/jbd/transaction.c	2004-08-26 17:12:40.000000000 +0400
-+++ linux-2.6.7/fs/jbd/transaction.c	2005-03-08 11:55:04.000000000 +0300
++++ linux-2.6.7/fs/jbd/transaction.c	2005-03-11 00:04:54.000000000 +0300
 @@ -524,7 +524,7 @@
   */
  static int
@@ -244,33 +244,42 @@ Index: linux-2.6.7/fs/jbd/transaction.c
  	if (jh->b_transaction == handle->h_transaction) {
  		J_ASSERT_JH(jh, !jh->b_frozen_data);
  
+@@ -2042,7 +2032,10 @@
+ 	__journal_unfile_buffer(jh);
+ 	jh->b_transaction = jh->b_next_transaction;
+ 	jh->b_next_transaction = NULL;
+-	__journal_file_buffer(jh, jh->b_transaction, BJ_Metadata);
++	if (jh->b_modified == 1)
++		__journal_file_buffer(jh, jh->b_transaction, BJ_Metadata);
++	else
++		__journal_file_buffer(jh, jh->b_transaction, BJ_Reserved);
+ 	J_ASSERT_JH(jh, jh->b_transaction->t_state == T_RUNNING);
+ 
+ 	if (was_dirty)
 Index: linux-2.6.7/fs/jbd/commit.c
 ===================================================================
 --- linux-2.6.7.orig/fs/jbd/commit.c	2004-08-26 17:12:40.000000000 +0400
-+++ linux-2.6.7/fs/jbd/commit.c	2005-03-08 11:55:04.000000000 +0300
-@@ -229,6 +229,22 @@
- 	jbd_debug (3, "JBD: commit phase 2\n");
++++ linux-2.6.7/fs/jbd/commit.c	2005-03-11 00:46:54.000000000 +0300
+@@ -204,6 +204,19 @@
+ 	}
  
  	/*
 +	 * First, drop modified flag: all accesses to the buffers
 +	 * will be tracked for a new trasaction only -bzzz
 +	 */
-+	spin_lock(&journal->j_list_lock);
 +	if (commit_transaction->t_buffers) {
 +		new_jh = jh = commit_transaction->t_buffers->b_tnext;
 +		do {
-+			J_ASSERT_JH(new_jh, new_jh->b_modified == 1 ||
-+					new_jh->b_modified == 0);
++			J_ASSERT_JH(new_jh, new_jh->b_modified == 1);
 +			new_jh->b_modified = 0;
 +			new_jh = new_jh->b_tnext;
 +		} while (new_jh != jh);
 +	}
-+	spin_unlock(&journal->j_list_lock);
 +
 +	/*
- 	 * Now start flushing things to disk, in the order they appear
- 	 * on the transaction lists.  Data blocks go first.
- 	 */
+ 	 * Now try to drop any written-back buffers from the journal's
+ 	 * checkpoint lists.  We do this *before* commit because it potentially
+ 	 * frees some memory
 Index: linux-2.6.7/fs/ext3/balloc.c
 ===================================================================
 --- linux-2.6.7.orig/fs/ext3/balloc.c	2004-08-26 17:11:16.000000000 +0400
-- 
GitLab