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.
This commit is contained in:
Brian Behlendorf
2010-06-11 14:53:23 -07:00
parent 32c6147dee
commit eb12b3782c
2 changed files with 9 additions and 1 deletions
+7 -1
View File
@@ -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;