From linux-kernel@vger.kernel.org Tue Jan 6 22:56:00 2004 Date: Tue, 06 Jan 2004 12:37:34 +0000 From: Linux Kernel Mailing List To: bk-commits-24@vger.kernel.org Subject: [PATCH] Handle j_commit_interval == 0 ChangeSet 1.1382, 2004/01/06 10:37:34-02:00, herbert@gondor.apana.org.au [PATCH] Handle j_commit_interval == 0 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. 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 # This patch includes the following deltas: # ChangeSet 1.1381 -> 1.1382 # fs/jbd/journal.c 1.13 -> 1.14 # fs/jbd/transaction.c 1.14 -> 1.15 # journal.c | 1 + transaction.c | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff -Nru a/fs/jbd/journal.c b/fs/jbd/journal.c --- a/fs/jbd/journal.c Tue Jan 6 05:02:13 2004 +++ b/fs/jbd/journal.c Tue Jan 6 05:02:13 2004 @@ -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"); diff -Nru a/fs/jbd/transaction.c b/fs/jbd/transaction.c --- a/fs/jbd/transaction.c Tue Jan 6 05:02:13 2004 +++ b/fs/jbd/transaction.c Tue Jan 6 05:02:13 2004 @@ -59,11 +59,13 @@ transaction->t_expires = jiffies + journal->j_commit_interval; 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) { + /* 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); + } 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. */ - To unsubscribe from this list: send the line "unsubscribe bk-commits-24" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html