Whamcloud - gitweb
jbd: add jbd-checkpoint-on-commit.patch.
authornikita <nikita>
Mon, 13 Nov 2006 22:37:37 +0000 (22:37 +0000)
committernikita <nikita>
Mon, 13 Nov 2006 22:37:37 +0000 (22:37 +0000)
lustre/kernel_patches/patches/jbd-checkpoint-on-commit.patch [new file with mode: 0644]
lustre/kernel_patches/series/2.6-rhel4.series

diff --git a/lustre/kernel_patches/patches/jbd-checkpoint-on-commit.patch b/lustre/kernel_patches/patches/jbd-checkpoint-on-commit.patch
new file mode 100644 (file)
index 0000000..86b2973
--- /dev/null
@@ -0,0 +1,52 @@
+Index: linux/fs/jbd/journal.c
+===================================================================
+--- linux.orig/fs/jbd/journal.c
++++ linux/fs/jbd/journal.c
+@@ -130,6 +130,7 @@ int kjournald(void *arg)
+       journal_t *journal = (journal_t *) arg;
+       transaction_t *transaction;
+       struct timer_list timer;
++      int transaction_size;
+       current_journal = journal;
+@@ -154,12 +155,15 @@ int kjournald(void *arg)
+        */
+       spin_lock(&journal->j_state_lock);
++      transaction_size = 0;
+ loop:
+       jbd_debug(1, "commit_sequence=%d, commit_request=%d\n",
+               journal->j_commit_sequence, journal->j_commit_request);
+       if (journal->j_commit_sequence != journal->j_commit_request) {
+               jbd_debug(1, "OK, requests differ\n");
++              transaction_size =
++                      journal->j_running_transaction->t_outstanding_credits;
+               spin_unlock(&journal->j_state_lock);
+               del_timer_sync(journal->j_commit_timer);
+               journal_commit_transaction(journal);
+@@ -168,6 +172,23 @@ loop:
+       }
+       wake_up(&journal->j_wait_done_commit);
++
++      /*
++       * If journal is low on free space, do a checkpoint, pro-actively.
++       *
++       * Do this after wake-up to reduce waiters latency.
++       */
++      spin_unlock(&journal->j_state_lock);
++      down(&journal->j_checkpoint_sem);
++      spin_lock(&journal->j_state_lock);
++      while (__log_space_left(journal) <
++             journal->j_max_transaction_buffers + 2 * transaction_size) {
++              spin_unlock(&journal->j_state_lock);
++              log_do_checkpoint(journal);
++              spin_lock(&journal->j_state_lock);
++      }
++      up(&journal->j_checkpoint_sem);
++
+       if (current->flags & PF_FREEZE) {
+               /*
+                * The simpler the better. Flushing journal isn't a
index 83609d2..6405575 100644 (file)
@@ -33,3 +33,4 @@ proc-sleep-2.6.9.patch
 pag-basic-2.6-rhel4.patch
 dynamic-locks-2.6.9.patch 
 jbd-copy-out-everything.patch 
+jbd-checkpoint-on-commit.patch