Commit e3df1898 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] jbd: embed j_commit_timer in journal struct

The kjournald timer is currently on the kernel thread's stack and the journal
structure points at it.  Save a pointer hop by moving the timer into the
journal structure.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1d9b7d97
...@@ -111,18 +111,17 @@ static void commit_timeout(unsigned long __data) ...@@ -111,18 +111,17 @@ static void commit_timeout(unsigned long __data)
static int kjournald(void *arg) static int kjournald(void *arg)
{ {
journal_t *journal = (journal_t *) arg; journal_t *journal = arg;
transaction_t *transaction; transaction_t *transaction;
struct timer_list timer;
daemonize("kjournald"); daemonize("kjournald");
/* Set up an interval timer which can be used to trigger a /*
commit wakeup after the commit interval expires */ * Set up an interval timer which can be used to trigger a commit wakeup
init_timer(&timer); * after the commit interval expires
timer.data = (unsigned long) current; */
timer.function = commit_timeout; setup_timer(&journal->j_commit_timer, commit_timeout,
journal->j_commit_timer = &timer; (unsigned long)current);
/* Record that the journal thread is running */ /* Record that the journal thread is running */
journal->j_task = current; journal->j_task = current;
...@@ -146,7 +145,7 @@ static int kjournald(void *arg) ...@@ -146,7 +145,7 @@ static int kjournald(void *arg)
if (journal->j_commit_sequence != journal->j_commit_request) { if (journal->j_commit_sequence != journal->j_commit_request) {
jbd_debug(1, "OK, requests differ\n"); jbd_debug(1, "OK, requests differ\n");
spin_unlock(&journal->j_state_lock); spin_unlock(&journal->j_state_lock);
del_timer_sync(journal->j_commit_timer); del_timer_sync(&journal->j_commit_timer);
journal_commit_transaction(journal); journal_commit_transaction(journal);
spin_lock(&journal->j_state_lock); spin_lock(&journal->j_state_lock);
goto loop; goto loop;
...@@ -203,7 +202,7 @@ static int kjournald(void *arg) ...@@ -203,7 +202,7 @@ static int kjournald(void *arg)
end_loop: end_loop:
spin_unlock(&journal->j_state_lock); spin_unlock(&journal->j_state_lock);
del_timer_sync(journal->j_commit_timer); del_timer_sync(&journal->j_commit_timer);
journal->j_task = NULL; journal->j_task = NULL;
wake_up(&journal->j_wait_done_commit); wake_up(&journal->j_wait_done_commit);
jbd_debug(1, "Journal thread exiting.\n"); jbd_debug(1, "Journal thread exiting.\n");
......
...@@ -53,8 +53,8 @@ get_transaction(journal_t *journal, transaction_t *transaction) ...@@ -53,8 +53,8 @@ get_transaction(journal_t *journal, transaction_t *transaction)
spin_lock_init(&transaction->t_handle_lock); spin_lock_init(&transaction->t_handle_lock);
/* Set up the commit timer for the new transaction. */ /* Set up the commit timer for the new transaction. */
journal->j_commit_timer->expires = transaction->t_expires; journal->j_commit_timer.expires = transaction->t_expires;
add_timer(journal->j_commit_timer); add_timer(&journal->j_commit_timer);
J_ASSERT(journal->j_running_transaction == NULL); J_ASSERT(journal->j_running_transaction == NULL);
journal->j_running_transaction = transaction; journal->j_running_transaction = transaction;
......
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/bit_spinlock.h> #include <linux/bit_spinlock.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/timer.h>
#include <asm/semaphore.h> #include <asm/semaphore.h>
#endif #endif
...@@ -787,7 +789,7 @@ struct journal_s ...@@ -787,7 +789,7 @@ struct journal_s
unsigned long j_commit_interval; unsigned long j_commit_interval;
/* The timer used to wakeup the commit thread: */ /* The timer used to wakeup the commit thread: */
struct timer_list *j_commit_timer; struct timer_list j_commit_timer;
/* /*
* The revoke table: maintains the list of revoked blocks in the * The revoke table: maintains the list of revoked blocks in the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment