Commit 87c1d2d3 authored by Kees Cook's avatar Kees Cook

lightnvm: 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.

Cc: Matias Bjorling <mb@lightnvm.io>
Cc: linux-block@vger.kernel.org
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
parent bd1a7b44
......@@ -270,9 +270,9 @@ static void pblk_write_kick(struct pblk *pblk)
mod_timer(&pblk->wtimer, jiffies + msecs_to_jiffies(1000));
}
void pblk_write_timer_fn(unsigned long data)
void pblk_write_timer_fn(struct timer_list *t)
{
struct pblk *pblk = (struct pblk *)data;
struct pblk *pblk = from_timer(pblk, t, wtimer);
/* kick the write thread every tick to flush outstanding data */
pblk_write_kick(pblk);
......
......@@ -442,9 +442,9 @@ static void pblk_gc_run(struct pblk *pblk)
goto next_gc_group;
}
static void pblk_gc_timer(unsigned long data)
static void pblk_gc_timer(struct timer_list *t)
{
struct pblk *pblk = (struct pblk *)data;
struct pblk *pblk = from_timer(pblk, t, gc.gc_timer);
pblk_gc_kick(pblk);
}
......@@ -601,7 +601,7 @@ int pblk_gc_init(struct pblk *pblk)
goto fail_free_writer_kthread;
}
setup_timer(&gc->gc_timer, pblk_gc_timer, (unsigned long)pblk);
timer_setup(&gc->gc_timer, pblk_gc_timer, 0);
mod_timer(&gc->gc_timer, jiffies + msecs_to_jiffies(GC_TIME_MSECS));
gc->gc_active = 0;
......
......@@ -866,7 +866,7 @@ static int pblk_lines_init(struct pblk *pblk)
static int pblk_writer_init(struct pblk *pblk)
{
setup_timer(&pblk->wtimer, pblk_write_timer_fn, (unsigned long)pblk);
timer_setup(&pblk->wtimer, pblk_write_timer_fn, 0);
mod_timer(&pblk->wtimer, jiffies + msecs_to_jiffies(100));
pblk->writer_ts = kthread_create(pblk_write_ts, pblk, "pblk-writer-t");
......
......@@ -158,9 +158,9 @@ int pblk_rl_max_io(struct pblk_rl *rl)
return rl->rb_max_io;
}
static void pblk_rl_u_timer(unsigned long data)
static void pblk_rl_u_timer(struct timer_list *t)
{
struct pblk_rl *rl = (struct pblk_rl *)data;
struct pblk_rl *rl = from_timer(rl, t, u_timer);
/* Release user I/O state. Protect from GC */
smp_store_release(&rl->rb_user_active, 0);
......@@ -202,7 +202,7 @@ void pblk_rl_init(struct pblk_rl *rl, int budget)
atomic_set(&rl->rb_gc_cnt, 0);
atomic_set(&rl->rb_space, -1);
setup_timer(&rl->u_timer, pblk_rl_u_timer, (unsigned long)rl);
timer_setup(&rl->u_timer, pblk_rl_u_timer, 0);
rl->rb_user_active = 0;
rl->rb_gc_active = 0;
......
......@@ -797,7 +797,7 @@ void pblk_map_rq(struct pblk *pblk, struct nvm_rq *rqd, unsigned int sentry,
* pblk write thread
*/
int pblk_write_ts(void *data);
void pblk_write_timer_fn(unsigned long data);
void pblk_write_timer_fn(struct timer_list *t);
void pblk_write_should_kick(struct pblk *pblk);
/*
......
......@@ -267,9 +267,9 @@ static void rrpc_gc_kick(struct rrpc *rrpc)
/*
* timed GC every interval.
*/
static void rrpc_gc_timer(unsigned long data)
static void rrpc_gc_timer(struct timer_list *t)
{
struct rrpc *rrpc = (struct rrpc *)data;
struct rrpc *rrpc = from_timer(rrpc, t, gc_timer);
rrpc_gc_kick(rrpc);
mod_timer(&rrpc->gc_timer, jiffies + msecs_to_jiffies(10));
......@@ -1063,7 +1063,7 @@ static int rrpc_gc_init(struct rrpc *rrpc)
if (!rrpc->kgc_wq)
return -ENOMEM;
setup_timer(&rrpc->gc_timer, rrpc_gc_timer, (unsigned long)rrpc);
timer_setup(&rrpc->gc_timer, rrpc_gc_timer, 0);
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment