add patch jbd2-convert-timers-to-use-timer_setup
[ext4-patch-queue.git] / jbd2-convert-timers-to-use-timer_setup
blob0df233bd9164afe2370c9440ff9ca1e999c093ea
1 jbd2: convert timers to use timer_setup()
3 From: Kees Cook <keescook@chromium.org>
5 In preparation for unconditionally passing the struct timer_list pointer to
6 all timer callbacks, switch to using the new timer_setup() and from_timer()
7 to pass the timer pointer explicitly.
9 Signed-off-by: Kees Cook <keescook@chromium.org>
10 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
11 Reviewed-by: Jan Kara <jack@suse.com>
12 Cc: linux-ext4@vger.kernel.org
13 Cc: Thomas Gleixner <tglx@linutronix.de>
14 ---
15 This requires commit 686fef928bba ("timer: Prepare to change timer
16 callback argument type") in v4.14-rc3, but should be otherwise
17 stand-alone.
18 ---
19  fs/jbd2/journal.c | 9 ++++-----
20  1 file changed, 4 insertions(+), 5 deletions(-)
22 diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
23 index 7d5ef3bf3f3e..d2a85c9720e9 100644
24 --- a/fs/jbd2/journal.c
25 +++ b/fs/jbd2/journal.c
26 @@ -165,11 +165,11 @@ static void jbd2_superblock_csum_set(journal_t *j, journal_superblock_t *sb)
27   * Helper function used to manage commit timeouts
28   */
30 -static void commit_timeout(unsigned long __data)
31 +static void commit_timeout(struct timer_list *t)
32  {
33 -       struct task_struct * p = (struct task_struct *) __data;
34 +       journal_t *journal = from_timer(journal, t, j_commit_timer);
36 -       wake_up_process(p);
37 +       wake_up_process(journal->j_task);
38  }
40  /*
41 @@ -197,8 +197,7 @@ static int kjournald2(void *arg)
42          * Set up an interval timer which can be used to trigger a commit wakeup
43          * after the commit interval expires
44          */
45 -       setup_timer(&journal->j_commit_timer, commit_timeout,
46 -                       (unsigned long)current);
47 +       timer_setup(&journal->j_commit_timer, commit_timeout, 0);
49         set_freezable();
51 -- 
52 2.7.4
55 -- 
56 Kees Cook
57 Pixel Security