* [PATCH] ext4: Convert timers to use timer_setup()
@ 2017-10-05 0:52 Kees Cook
2017-10-12 14:58 ` Jan Kara
0 siblings, 1 reply; 4+ messages in thread
From: Kees Cook @ 2017-10-05 0:52 UTC (permalink / raw)
To: linux-kernel
Cc: Theodore Ts'o, Andreas Dilger, 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: Andreas Dilger <adilger.kernel@dilger.ca>
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/ext4/super.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index b104096fce9e..1bc7ff8157d8 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2791,14 +2791,11 @@ static int ext4_feature_set_ok(struct super_block *sb, int readonly)
* This function is called once a day if we have errors logged
* on the file system
*/
-static void print_daily_error_info(unsigned long arg)
+static void print_daily_error_info(struct timer_list *t)
{
- struct super_block *sb = (struct super_block *) arg;
- struct ext4_sb_info *sbi;
- struct ext4_super_block *es;
-
- sbi = EXT4_SB(sb);
- es = sbi->s_es;
+ struct ext4_sb_info *sbi = from_timer(sbi, t, s_err_report);
+ struct super_block *sb = sbi->s_sb;
+ struct ext4_super_block *es = sbi->s_es;
if (es->s_error_count)
/* fsck newer than v1.41.13 is needed to clean this condition. */
@@ -3980,8 +3977,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
get_random_bytes(&sbi->s_next_generation, sizeof(u32));
spin_lock_init(&sbi->s_next_gen_lock);
- setup_timer(&sbi->s_err_report, print_daily_error_info,
- (unsigned long) sb);
+ timer_setup(&sbi->s_err_report, print_daily_error_info, 0);
/* Register extent status tree shrinker */
if (ext4_es_register_shrinker(sbi))
--
2.7.4
--
Kees Cook
Pixel Security
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: Convert timers to use timer_setup()
2017-10-05 0:52 Kees Cook
@ 2017-10-12 14:58 ` Jan Kara
0 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2017-10-12 14:58 UTC (permalink / raw)
To: Kees Cook
Cc: linux-kernel, Theodore Ts'o, Andreas Dilger, linux-ext4,
Thomas Gleixner
On Wed 04-10-17 17:52:54, 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: Andreas Dilger <adilger.kernel@dilger.ca>
> Cc: linux-ext4@vger.kernel.org
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Kees Cook <keescook@chromium.org>
The patch looks good. 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/ext4/super.c | 14 +++++---------
> 1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index b104096fce9e..1bc7ff8157d8 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -2791,14 +2791,11 @@ static int ext4_feature_set_ok(struct super_block *sb, int readonly)
> * This function is called once a day if we have errors logged
> * on the file system
> */
> -static void print_daily_error_info(unsigned long arg)
> +static void print_daily_error_info(struct timer_list *t)
> {
> - struct super_block *sb = (struct super_block *) arg;
> - struct ext4_sb_info *sbi;
> - struct ext4_super_block *es;
> -
> - sbi = EXT4_SB(sb);
> - es = sbi->s_es;
> + struct ext4_sb_info *sbi = from_timer(sbi, t, s_err_report);
> + struct super_block *sb = sbi->s_sb;
> + struct ext4_super_block *es = sbi->s_es;
>
> if (es->s_error_count)
> /* fsck newer than v1.41.13 is needed to clean this condition. */
> @@ -3980,8 +3977,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
> get_random_bytes(&sbi->s_next_generation, sizeof(u32));
> spin_lock_init(&sbi->s_next_gen_lock);
>
> - setup_timer(&sbi->s_err_report, print_daily_error_info,
> - (unsigned long) sb);
> + timer_setup(&sbi->s_err_report, print_daily_error_info, 0);
>
> /* Register extent status tree shrinker */
> if (ext4_es_register_shrinker(sbi))
> --
> 2.7.4
>
>
> --
> Kees Cook
> Pixel Security
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] ext4: Convert timers to use timer_setup()
@ 2017-10-17 0:00 Kees Cook
2017-10-18 16:46 ` Theodore Ts'o
0 siblings, 1 reply; 4+ messages in thread
From: Kees Cook @ 2017-10-17 0:00 UTC (permalink / raw)
To: Theodore Ts'o; +Cc: Andreas Dilger, linux-ext4, linux-kernel
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: Andreas Dilger <adilger.kernel@dilger.ca>
Cc: linux-ext4@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Reviewed-by: Jan Kara <jack@suse.cz>
---
fs/ext4/super.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index b5d393321b7b..759281cec51f 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2793,14 +2793,11 @@ static int ext4_feature_set_ok(struct super_block *sb, int readonly)
* This function is called once a day if we have errors logged
* on the file system
*/
-static void print_daily_error_info(unsigned long arg)
+static void print_daily_error_info(struct timer_list *t)
{
- struct super_block *sb = (struct super_block *) arg;
- struct ext4_sb_info *sbi;
- struct ext4_super_block *es;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: Convert timers to use timer_setup()
2017-10-17 0:00 [PATCH] ext4: Convert timers to use timer_setup() Kees Cook
@ 2017-10-18 16:46 ` Theodore Ts'o
0 siblings, 0 replies; 4+ messages in thread
From: Theodore Ts'o @ 2017-10-18 16:46 UTC (permalink / raw)
To: Kees Cook; +Cc: Andreas Dilger, linux-ext4, linux-kernel
On Mon, Oct 16, 2017 at 05:00:19PM -0700, 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: Andreas Dilger <adilger.kernel@dilger.ca>
> Cc: linux-ext4@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
> Reviewed-by: Reviewed-by: Jan Kara <jack@suse.cz>
Applied, thanks.
- Ted
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-10-18 16:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-17 0:00 [PATCH] ext4: Convert timers to use timer_setup() Kees Cook
2017-10-18 16:46 ` Theodore Ts'o
-- strict thread matches above, loose matches on Subject: below --
2017-10-05 0:52 Kees Cook
2017-10-12 14:58 ` Jan Kara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).