patch-2.4.18 linux/fs/jbd/commit.c

Next file: linux/fs/jbd/journal.c
Previous file: linux/fs/jbd/checkpoint.c
Back to the patch index
Back to the overall index

diff -Naur -X /home/marcelo/lib/dontdiff linux.orig/fs/jbd/commit.c linux/fs/jbd/commit.c
@@ -26,7 +26,7 @@
 /*
  * Default IO end handler for temporary BJ_IO buffer_heads.
  */
-static void journal_end_buffer_io_sync(struct buffer_head *bh, int uptodate)
+void journal_end_buffer_io_sync(struct buffer_head *bh, int uptodate)
 {
 	BUFFER_TRACE(bh, "");
 	mark_buffer_uptodate(bh, uptodate);
@@ -410,6 +410,7 @@
 		flags = journal_write_metadata_buffer(commit_transaction,
 						      jh, &new_jh, blocknr);
 		set_bit(BH_JWrite, &jh2bh(new_jh)->b_state);
+		set_bit(BH_Lock, &jh2bh(new_jh)->b_state);
 		wbuf[bufs++] = jh2bh(new_jh);
 
 		/* Record the new block's tag in the current descriptor
@@ -453,7 +454,6 @@
 			unlock_journal(journal);
 			for (i=0; i<bufs; i++) {
 				struct buffer_head *bh = wbuf[i];
-				set_bit(BH_Lock, &bh->b_state);
 				clear_bit(BH_Dirty, &bh->b_state);
 				bh->b_end_io = journal_end_buffer_io_sync;
 				submit_bh(WRITE, bh);
@@ -561,8 +561,7 @@
 		journal_unfile_buffer(jh);
 		jh->b_transaction = NULL;
 		journal_unlock_journal_head(jh);
-		__brelse(bh);		/* One for getblk */
-		/* AKPM: bforget here */
+		put_bh(bh);			/* One for getblk */
 	}
 
 	jbd_debug(3, "JBD: commit phase 6\n");
@@ -594,9 +593,11 @@
 	JBUFFER_TRACE(descriptor, "write commit block");
 	{
 		struct buffer_head *bh = jh2bh(descriptor);
-		ll_rw_block(WRITE, 1, &bh);
+		clear_bit(BH_Dirty, &bh->b_state);
+		bh->b_end_io = journal_end_buffer_io_sync;
+		submit_bh(WRITE, bh);
 		wait_on_buffer(bh);
-		__brelse(bh);		/* One for getblk() */
+		put_bh(bh);		/* One for getblk() */
 		journal_unlock_journal_head(descriptor);
 	}
 	lock_journal(journal);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)