summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2017-11-17 18:29:32 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-17 19:10:03 -0500
commit7554e9c4cfa208acf3164a86c05aaa967b043425 (patch)
treefd89423abb2149756c766de38062d04959ac3988
parentfb910c42ccebf853c29296185c45c11164a56098 (diff)
fs/nilfs2: convert timers to use timer_setup()
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. This requires adding a pointer to hold the timer's target task, as the lifetime of sc_task doesn't appear to match the timer's task. Link: http://lkml.kernel.org/r/20171016235900.GA102729@beast Signed-off-by: Kees Cook <keescook@chromium.org> Acked-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/nilfs2/segment.c11
-rw-r--r--fs/nilfs2/segment.h1
2 files changed, 6 insertions, 6 deletions
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index f65392fecb5c..472f0b53a724 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -2400,11 +2400,11 @@ static int nilfs_segctor_construct(struct nilfs_sc_info *sci, int mode)
2400 return err; 2400 return err;
2401} 2401}
2402 2402
2403static void nilfs_construction_timeout(unsigned long data) 2403static void nilfs_construction_timeout(struct timer_list *t)
2404{ 2404{
2405 struct task_struct *p = (struct task_struct *)data; 2405 struct nilfs_sc_info *sci = from_timer(sci, t, sc_timer);
2406 2406
2407 wake_up_process(p); 2407 wake_up_process(sci->sc_timer_task);
2408} 2408}
2409 2409
2410static void 2410static void
@@ -2542,8 +2542,7 @@ static int nilfs_segctor_thread(void *arg)
2542 struct the_nilfs *nilfs = sci->sc_super->s_fs_info; 2542 struct the_nilfs *nilfs = sci->sc_super->s_fs_info;
2543 int timeout = 0; 2543 int timeout = 0;
2544 2544
2545 sci->sc_timer.data = (unsigned long)current; 2545 sci->sc_timer_task = current;
2546 sci->sc_timer.function = nilfs_construction_timeout;
2547 2546
2548 /* start sync. */ 2547 /* start sync. */
2549 sci->sc_task = current; 2548 sci->sc_task = current;
@@ -2674,7 +2673,7 @@ static struct nilfs_sc_info *nilfs_segctor_new(struct super_block *sb,
2674 INIT_LIST_HEAD(&sci->sc_gc_inodes); 2673 INIT_LIST_HEAD(&sci->sc_gc_inodes);
2675 INIT_LIST_HEAD(&sci->sc_iput_queue); 2674 INIT_LIST_HEAD(&sci->sc_iput_queue);
2676 INIT_WORK(&sci->sc_iput_work, nilfs_iput_work_func); 2675 INIT_WORK(&sci->sc_iput_work, nilfs_iput_work_func);
2677 init_timer(&sci->sc_timer); 2676 timer_setup(&sci->sc_timer, nilfs_construction_timeout, 0);
2678 2677
2679 sci->sc_interval = HZ * NILFS_SC_DEFAULT_TIMEOUT; 2678 sci->sc_interval = HZ * NILFS_SC_DEFAULT_TIMEOUT;
2680 sci->sc_mjcp_freq = HZ * NILFS_SC_DEFAULT_SR_FREQ; 2679 sci->sc_mjcp_freq = HZ * NILFS_SC_DEFAULT_SR_FREQ;
diff --git a/fs/nilfs2/segment.h b/fs/nilfs2/segment.h
index 1060949d7dd2..84084a4d9b3e 100644
--- a/fs/nilfs2/segment.h
+++ b/fs/nilfs2/segment.h
@@ -180,6 +180,7 @@ struct nilfs_sc_info {
180 unsigned long sc_watermark; 180 unsigned long sc_watermark;
181 181
182 struct timer_list sc_timer; 182 struct timer_list sc_timer;
183 struct task_struct *sc_timer_task;
183 struct task_struct *sc_task; 184 struct task_struct *sc_task;
184}; 185};
185 186