From 9a17da4d50c3eb08a0f97a895e12b6e33918416b Mon Sep 17 00:00:00 2001 From: nikita Date: Mon, 13 Nov 2006 22:37:37 +0000 Subject: [PATCH] jbd: add jbd-checkpoint-on-commit.patch. --- .../patches/jbd-checkpoint-on-commit.patch | 52 ++++++++++++++++++++++ lustre/kernel_patches/series/2.6-rhel4.series | 1 + 2 files changed, 53 insertions(+) create mode 100644 lustre/kernel_patches/patches/jbd-checkpoint-on-commit.patch 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 index 0000000..86b2973 --- /dev/null +++ b/lustre/kernel_patches/patches/jbd-checkpoint-on-commit.patch @@ -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 diff --git a/lustre/kernel_patches/series/2.6-rhel4.series b/lustre/kernel_patches/series/2.6-rhel4.series index 83609d2..6405575 100644 --- a/lustre/kernel_patches/series/2.6-rhel4.series +++ b/lustre/kernel_patches/series/2.6-rhel4.series @@ -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 -- 1.8.3.1