aboutsummaryrefslogtreecommitdiffstats
path: root/module/spl/spl-taskq.c
diff options
context:
space:
mode:
authorTony Hutter <[email protected]>2017-12-21 10:56:32 -0800
committerBrian Behlendorf <[email protected]>2017-12-21 10:56:32 -0800
commitc9821f1ccc647dfbd506f381b736c664d862d126 (patch)
tree71c28fd1502bd304bf1f033f74ab86c614de23e5 /module/spl/spl-taskq.c
parented19bccfb651843fa208232b3a2d3d22a4152bc8 (diff)
Linux 4.15 compat: timer updates
Use timer_setup() macro and new timeout function definition. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Tony Hutter <[email protected]> Closes #670 Closes #671
Diffstat (limited to 'module/spl/spl-taskq.c')
-rw-r--r--module/spl/spl-taskq.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c
index 50f6f520f..ae26bdb2e 100644
--- a/module/spl/spl-taskq.c
+++ b/module/spl/spl-taskq.c
@@ -206,9 +206,9 @@ task_done(taskq_t *tq, taskq_ent_t *t)
* add it to the priority list in order for immediate processing.
*/
static void
-task_expire(unsigned long data)
+task_expire_impl(taskq_ent_t *t)
{
- taskq_ent_t *w, *t = (taskq_ent_t *)data;
+ taskq_ent_t *w;
taskq_t *tq = t->tqent_taskq;
struct list_head *l;
unsigned long flags;
@@ -242,6 +242,21 @@ task_expire(unsigned long data)
wake_up(&tq->tq_work_waitq);
}
+#ifdef HAVE_KERNEL_TIMER_FUNCTION_TIMER_LIST
+static void
+task_expire(struct timer_list *tl)
+{
+ taskq_ent_t *t = from_timer(t, tl, tqent_timer);
+ task_expire_impl(t);
+}
+#else
+static void
+task_expire(unsigned long data)
+{
+ task_expire_impl((taskq_ent_t *)data);
+}
+#endif
+
/*
* Returns the lowest incomplete taskqid_t. The taskqid_t may
* be queued on the pending list, on the priority list, on the
@@ -581,7 +596,9 @@ taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags)
t->tqent_func = func;
t->tqent_arg = arg;
t->tqent_taskq = tq;
+#ifndef HAVE_KERNEL_TIMER_FUNCTION_TIMER_LIST
t->tqent_timer.data = 0;
+#endif
t->tqent_timer.function = NULL;
t->tqent_timer.expires = 0;
t->tqent_birth = jiffies;
@@ -631,7 +648,9 @@ taskq_dispatch_delay(taskq_t *tq, task_func_t func, void *arg,
t->tqent_func = func;
t->tqent_arg = arg;
t->tqent_taskq = tq;
+#ifndef HAVE_KERNEL_TIMER_FUNCTION_TIMER_LIST
t->tqent_timer.data = (unsigned long)t;
+#endif
t->tqent_timer.function = task_expire;
t->tqent_timer.expires = (unsigned long)expire_time;
add_timer(&t->tqent_timer);
@@ -723,7 +742,11 @@ taskq_init_ent(taskq_ent_t *t)
{
spin_lock_init(&t->tqent_lock);
init_waitqueue_head(&t->tqent_waitq);
+#ifdef HAVE_KERNEL_TIMER_FUNCTION_TIMER_LIST
+ timer_setup(&t->tqent_timer, NULL, 0);
+#else
init_timer(&t->tqent_timer);
+#endif
INIT_LIST_HEAD(&t->tqent_list);
t->tqent_id = 0;
t->tqent_func = NULL;