[JBD] Handle j_commit_interval == 0
diff mbox series

Message ID 20031129092458.GA19338@gondor.apana.org.au
State New, archived
Headers show
Series
  • [JBD] Handle j_commit_interval == 0
Related show

Commit Message

Herbert Xu Nov. 29, 2003, 9:24 a.m. UTC
Hi:

After the laptop mode patch was merged, it is now possible for
j_commit_interval to be zero.  Unfortunately jbd doesn't handle
this situation very well.

This patch makes it do the sensible thing.

Cheers,

Comments

Ingo Oeser Nov. 30, 2003, 9:50 a.m. UTC | #1
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Herbert,

On Saturday 29 November 2003 10:24, Herbert Xu wrote:
> After the laptop mode patch was merged, it is now possible for
> j_commit_interval to be zero.  Unfortunately jbd doesn't handle
> this situation very well.
>
> This patch makes it do the sensible thing.

What about abstracting these away in "set_journal_expire" and
"is_journal_expired"?

Otherwise this will surely be missed in the future.

Regards

Ingo Oeser

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/yb16U56oYWuOrkARAqqVAKCrTi/s2wzeUVQnKeOSv4rIWi+HawCgzdJZ
RboSmYzfo2uK9Sygpksmatc=
=nLqv
-----END PGP SIGNATURE-----

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

Patch
diff mbox series

Index: kernel-source-2.4/fs/jbd/journal.c
===================================================================
RCS file: /home/gondolin/herbert/src/CVS/debian/kernel-source-2.4/fs/jbd/journal.c,v
retrieving revision 1.1.1.9
diff -u -r1.1.1.9 journal.c
--- kernel-source-2.4/fs/jbd/journal.c	29 Nov 2003 06:39:14 -0000	1.1.1.9
+++ kernel-source-2.4/fs/jbd/journal.c	29 Nov 2003 09:20:32 -0000
@@ -253,6 +253,7 @@ 
 
 		/* Were we woken up by a commit wakeup event? */
 		if ((transaction = journal->j_running_transaction) != NULL &&
+		    journal->j_commit_interval &&
 		    time_after_eq(jiffies, transaction->t_expires)) {
 			journal->j_commit_request = transaction->t_tid;
 			jbd_debug(1, "woke because of timeout\n");
Index: kernel-source-2.4/fs/jbd/transaction.c
===================================================================
RCS file: /home/gondolin/herbert/src/CVS/debian/kernel-source-2.4/fs/jbd/transaction.c,v
retrieving revision 1.1.1.6
diff -u -r1.1.1.6 transaction.c
--- kernel-source-2.4/fs/jbd/transaction.c	28 Nov 2003 18:26:21 -0000	1.1.1.6
+++ kernel-source-2.4/fs/jbd/transaction.c	29 Nov 2003 06:59:58 -0000
@@ -60,10 +60,12 @@ 
 	INIT_LIST_HEAD(&transaction->t_jcb);
 
 	/* Set up the commit timer for the new transaction. */
-	J_ASSERT (!journal->j_commit_timer_active);
-	journal->j_commit_timer_active = 1;
-	journal->j_commit_timer->expires = transaction->t_expires;
-	add_timer(journal->j_commit_timer);
+	if (journal->j_commit_interval) {
+		J_ASSERT (!journal->j_commit_timer_active);
+		journal->j_commit_timer_active = 1;
+		journal->j_commit_timer->expires = transaction->t_expires;
+		add_timer(journal->j_commit_timer);
+	}
 	
 	J_ASSERT (journal->j_running_transaction == NULL);
 	journal->j_running_transaction = transaction;
@@ -1465,7 +1467,8 @@ 
 	if (handle->h_sync ||
 			transaction->t_outstanding_credits >
 				journal->j_max_transaction_buffers ||
-	    		time_after_eq(jiffies, transaction->t_expires)) {
+	    		(journal->j_commit_interval &&
+	    		 time_after_eq(jiffies, transaction->t_expires))) {
 		/* Do this even for aborted journals: an abort still
 		 * completes the commit thread, it just doesn't write
 		 * anything to disk. */