diff options
author | Andrew Morton <akpm@osdl.org> | 2006-03-25 06:06:53 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-25 11:22:50 -0500 |
commit | e3df18983ea090a2e00dd5c2c6167bb431a0e0a2 (patch) | |
tree | 99f7944da7c8c85eed6738c1ef9f357f7dcae928 | |
parent | 1d9b7d97d6661edb44ce08f17e47c66d4ac20e34 (diff) |
[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: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | fs/jbd/journal.c | 19 | ||||
-rw-r--r-- | fs/jbd/transaction.c | 4 | ||||
-rw-r--r-- | include/linux/jbd.h | 4 |
3 files changed, 14 insertions, 13 deletions
diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c index 95a628d8cac8..6bd4647dc5a1 100644 --- a/fs/jbd/journal.c +++ b/fs/jbd/journal.c | |||
@@ -111,18 +111,17 @@ static void commit_timeout(unsigned long __data) | |||
111 | 111 | ||
112 | static int kjournald(void *arg) | 112 | static int kjournald(void *arg) |
113 | { | 113 | { |
114 | journal_t *journal = (journal_t *) arg; | 114 | journal_t *journal = arg; |
115 | transaction_t *transaction; | 115 | transaction_t *transaction; |
116 | struct timer_list timer; | ||
117 | 116 | ||
118 | daemonize("kjournald"); | 117 | daemonize("kjournald"); |
119 | 118 | ||
120 | /* Set up an interval timer which can be used to trigger a | 119 | /* |
121 | commit wakeup after the commit interval expires */ | 120 | * Set up an interval timer which can be used to trigger a commit wakeup |
122 | init_timer(&timer); | 121 | * after the commit interval expires |
123 | timer.data = (unsigned long) current; | 122 | */ |
124 | timer.function = commit_timeout; | 123 | setup_timer(&journal->j_commit_timer, commit_timeout, |
125 | journal->j_commit_timer = &timer; | 124 | (unsigned long)current); |
126 | 125 | ||
127 | /* Record that the journal thread is running */ | 126 | /* Record that the journal thread is running */ |
128 | journal->j_task = current; | 127 | journal->j_task = current; |
@@ -146,7 +145,7 @@ loop: | |||
146 | if (journal->j_commit_sequence != journal->j_commit_request) { | 145 | if (journal->j_commit_sequence != journal->j_commit_request) { |
147 | jbd_debug(1, "OK, requests differ\n"); | 146 | jbd_debug(1, "OK, requests differ\n"); |
148 | spin_unlock(&journal->j_state_lock); | 147 | spin_unlock(&journal->j_state_lock); |
149 | del_timer_sync(journal->j_commit_timer); | 148 | del_timer_sync(&journal->j_commit_timer); |
150 | journal_commit_transaction(journal); | 149 | journal_commit_transaction(journal); |
151 | spin_lock(&journal->j_state_lock); | 150 | spin_lock(&journal->j_state_lock); |
152 | goto loop; | 151 | goto loop; |
@@ -203,7 +202,7 @@ loop: | |||
203 | 202 | ||
204 | end_loop: | 203 | end_loop: |
205 | spin_unlock(&journal->j_state_lock); | 204 | spin_unlock(&journal->j_state_lock); |
206 | del_timer_sync(journal->j_commit_timer); | 205 | del_timer_sync(&journal->j_commit_timer); |
207 | journal->j_task = NULL; | 206 | journal->j_task = NULL; |
208 | wake_up(&journal->j_wait_done_commit); | 207 | wake_up(&journal->j_wait_done_commit); |
209 | jbd_debug(1, "Journal thread exiting.\n"); | 208 | jbd_debug(1, "Journal thread exiting.\n"); |
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c index 5fc40888f4cf..ada31fa272e3 100644 --- a/fs/jbd/transaction.c +++ b/fs/jbd/transaction.c | |||
@@ -53,8 +53,8 @@ get_transaction(journal_t *journal, transaction_t *transaction) | |||
53 | spin_lock_init(&transaction->t_handle_lock); | 53 | spin_lock_init(&transaction->t_handle_lock); |
54 | 54 | ||
55 | /* Set up the commit timer for the new transaction. */ | 55 | /* Set up the commit timer for the new transaction. */ |
56 | journal->j_commit_timer->expires = transaction->t_expires; | 56 | journal->j_commit_timer.expires = transaction->t_expires; |
57 | add_timer(journal->j_commit_timer); | 57 | add_timer(&journal->j_commit_timer); |
58 | 58 | ||
59 | J_ASSERT(journal->j_running_transaction == NULL); | 59 | J_ASSERT(journal->j_running_transaction == NULL); |
60 | journal->j_running_transaction = transaction; | 60 | journal->j_running_transaction = transaction; |
diff --git a/include/linux/jbd.h b/include/linux/jbd.h index 2ccbfb6340ba..4fc7dffd66ef 100644 --- a/include/linux/jbd.h +++ b/include/linux/jbd.h | |||
@@ -29,6 +29,8 @@ | |||
29 | #include <linux/stddef.h> | 29 | #include <linux/stddef.h> |
30 | #include <linux/bit_spinlock.h> | 30 | #include <linux/bit_spinlock.h> |
31 | #include <linux/mutex.h> | 31 | #include <linux/mutex.h> |
32 | #include <linux/timer.h> | ||
33 | |||
32 | #include <asm/semaphore.h> | 34 | #include <asm/semaphore.h> |
33 | #endif | 35 | #endif |
34 | 36 | ||
@@ -787,7 +789,7 @@ struct journal_s | |||
787 | unsigned long j_commit_interval; | 789 | unsigned long j_commit_interval; |
788 | 790 | ||
789 | /* The timer used to wakeup the commit thread: */ | 791 | /* The timer used to wakeup the commit thread: */ |
790 | struct timer_list *j_commit_timer; | 792 | struct timer_list j_commit_timer; |
791 | 793 | ||
792 | /* | 794 | /* |
793 | * The revoke table: maintains the list of revoked blocks in the | 795 | * The revoke table: maintains the list of revoked blocks in the |