aboutsummaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2010-06-11 14:53:23 -0700
committerBrian Behlendorf <[email protected]>2010-06-11 15:57:25 -0700
commiteb12b3782c94113d2d40d2da22265dc4111a672b (patch)
treede7edb48e1a7db6def3452a3e93d7ec6fbcd4f9c /module
parent32c6147dee702e6033a9f3b4999a0b9025a88260 (diff)
Support TQ_FRONT flag used by taskq_dispatch()
Allow taskq_dispatch() to insert work items at the head of the queue instead of just the tail by passing the TQ_FRONT flag.
Diffstat (limited to 'module')
-rw-r--r--module/spl/spl-taskq.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c
index 805749a14..fba38021f 100644
--- a/module/spl/spl-taskq.c
+++ b/module/spl/spl-taskq.c
@@ -274,7 +274,13 @@ __taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags)
GOTO(out, rc = 0);
spin_lock(&t->t_lock);
- list_add_tail(&t->t_list, &tq->tq_pend_list);
+
+ /* Queue to the head instead of the tail */
+ if (flags & TQ_FRONT)
+ list_add(&t->t_list, &tq->tq_pend_list);
+ else
+ list_add_tail(&t->t_list, &tq->tq_pend_list);
+
t->t_id = rc = tq->tq_next_id;
tq->tq_next_id++;
t->t_func = func;