All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] jbd2: Convert timers to use timer_setup()
@ 2017-10-05  0:48 Kees Cook
  2017-10-10 11:20 ` Jan Kara
  0 siblings, 1 reply; 3+ messages in thread
From: Kees Cook @ 2017-10-05  0:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: Theodore Ts'o, Jan Kara, linux-ext4, Thomas Gleixner

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Jan Kara <jack@suse.com>
Cc: linux-ext4@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
This requires commit 686fef928bba ("timer: Prepare to change timer
callback argument type") in v4.14-rc3, but should be otherwise
stand-alone.
---
 fs/jbd2/journal.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 7d5ef3bf3f3e..d2a85c9720e9 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -165,11 +165,11 @@ static void jbd2_superblock_csum_set(journal_t *j, journal_superblock_t *sb)
  * Helper function used to manage commit timeouts
  */
 
-static void commit_timeout(unsigned long __data)
+static void commit_timeout(struct timer_list *t)
 {
-	struct task_struct * p = (struct task_struct *) __data;
+	journal_t *journal = from_timer(journal, t, j_commit_timer);
 
-	wake_up_process(p);
+	wake_up_process(journal->j_task);
 }
 
 /*
@@ -197,8 +197,7 @@ static int kjournald2(void *arg)
 	 * Set up an interval timer which can be used to trigger a commit wakeup
 	 * after the commit interval expires
 	 */
-	setup_timer(&journal->j_commit_timer, commit_timeout,
-			(unsigned long)current);
+	timer_setup(&journal->j_commit_timer, commit_timeout, 0);
 
 	set_freezable();
 
-- 
2.7.4


-- 
Kees Cook
Pixel Security

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] jbd2: Convert timers to use timer_setup()
  2017-10-05  0:48 [PATCH] jbd2: Convert timers to use timer_setup() Kees Cook
@ 2017-10-10 11:20 ` Jan Kara
  2017-10-18 16:44   ` Theodore Ts'o
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kara @ 2017-10-10 11:20 UTC (permalink / raw)
  To: Kees Cook
  Cc: linux-kernel, Theodore Ts'o, Jan Kara, linux-ext4, Thomas Gleixner

On Wed 04-10-17 17:48:46, Kees Cook wrote:
> In preparation for unconditionally passing the struct timer_list pointer to
> all timer callbacks, switch to using the new timer_setup() and from_timer()
> to pass the timer pointer explicitly.
> 
> Cc: "Theodore Ts'o" <tytso@mit.edu>
> Cc: Jan Kara <jack@suse.com>
> Cc: linux-ext4@vger.kernel.org
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Kees Cook <keescook@chromium.org>

The patch looks good to me. You can add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza


> ---
> This requires commit 686fef928bba ("timer: Prepare to change timer
> callback argument type") in v4.14-rc3, but should be otherwise
> stand-alone.
> ---
>  fs/jbd2/journal.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
> index 7d5ef3bf3f3e..d2a85c9720e9 100644
> --- a/fs/jbd2/journal.c
> +++ b/fs/jbd2/journal.c
> @@ -165,11 +165,11 @@ static void jbd2_superblock_csum_set(journal_t *j, journal_superblock_t *sb)
>   * Helper function used to manage commit timeouts
>   */
>  
> -static void commit_timeout(unsigned long __data)
> +static void commit_timeout(struct timer_list *t)
>  {
> -	struct task_struct * p = (struct task_struct *) __data;
> +	journal_t *journal = from_timer(journal, t, j_commit_timer);
>  
> -	wake_up_process(p);
> +	wake_up_process(journal->j_task);
>  }
>  
>  /*
> @@ -197,8 +197,7 @@ static int kjournald2(void *arg)
>  	 * Set up an interval timer which can be used to trigger a commit wakeup
>  	 * after the commit interval expires
>  	 */
> -	setup_timer(&journal->j_commit_timer, commit_timeout,
> -			(unsigned long)current);
> +	timer_setup(&journal->j_commit_timer, commit_timeout, 0);
>  
>  	set_freezable();
>  
> -- 
> 2.7.4
> 
> 
> -- 
> Kees Cook
> Pixel Security
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] jbd2: Convert timers to use timer_setup()
  2017-10-10 11:20 ` Jan Kara
@ 2017-10-18 16:44   ` Theodore Ts'o
  0 siblings, 0 replies; 3+ messages in thread
From: Theodore Ts'o @ 2017-10-18 16:44 UTC (permalink / raw)
  To: Jan Kara; +Cc: Kees Cook, linux-kernel, Jan Kara, linux-ext4, Thomas Gleixner

On Tue, Oct 10, 2017 at 01:20:50PM +0200, Jan Kara wrote:
> On Wed 04-10-17 17:48:46, Kees Cook wrote:
> > In preparation for unconditionally passing the struct timer_list pointer to
> > all timer callbacks, switch to using the new timer_setup() and from_timer()
> > to pass the timer pointer explicitly.
> > 
> > Cc: "Theodore Ts'o" <tytso@mit.edu>
> > Cc: Jan Kara <jack@suse.com>
> > Cc: linux-ext4@vger.kernel.org
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Signed-off-by: Kees Cook <keescook@chromium.org>
> 
> The patch looks good to me. You can add:
> 
> Reviewed-by: Jan Kara <jack@suse.cz>

Applied, thanks.

						- Ted

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-10-18 16:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-05  0:48 [PATCH] jbd2: Convert timers to use timer_setup() Kees Cook
2017-10-10 11:20 ` Jan Kara
2017-10-18 16:44   ` Theodore Ts'o

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.