Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FreeBSD: Implement taskq_init_ent() #15455

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/os/freebsd/spl/sys/taskq.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ typedef struct taskq_ent {

#define TASKQID_INVALID ((taskqid_t)0)

#define taskq_init_ent(x)
extern taskq_t *system_taskq;
/* Global dynamic task queue for long delay */
extern taskq_t *system_delay_taskq;
Expand All @@ -92,6 +91,7 @@ extern taskqid_t taskq_dispatch_delay(taskq_t *, task_func_t, void *,
extern void taskq_dispatch_ent(taskq_t *, task_func_t, void *, uint_t,
taskq_ent_t *);
extern int taskq_empty_ent(taskq_ent_t *);
extern void taskq_init_ent(taskq_ent_t *);
taskq_t *taskq_create(const char *, int, pri_t, int, int, uint_t);
taskq_t *taskq_create_instance(const char *, int, int, pri_t, int, int, uint_t);
taskq_t *taskq_create_proc(const char *, int, pri_t, int, int,
Expand Down
30 changes: 18 additions & 12 deletions module/os/freebsd/spl/spl_taskq.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,21 +398,33 @@ void
taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint32_t flags,
taskq_ent_t *task)
{
int prio;

/*
* If TQ_FRONT is given, we want higher priority for this task, so it
* can go at the front of the queue.
*/
prio = !!(flags & TQ_FRONT);
task->tqent_id = 0;
task->tqent_task.ta_priority = !!(flags & TQ_FRONT);
task->tqent_func = func;
task->tqent_arg = arg;

TASK_INIT(&task->tqent_task, prio, taskq_run_ent, task);
taskqueue_enqueue(tq->tq_queue, &task->tqent_task);
}

void
taskq_init_ent(taskq_ent_t *task)
{
TASK_INIT(&task->tqent_task, 0, taskq_run_ent, task);
task->tqent_func = NULL;
task->tqent_arg = NULL;
task->tqent_id = 0;
task->tqent_type = NORMAL_TASK;
task->tqent_rc = 0;
}

int
taskq_empty_ent(taskq_ent_t *task)
{
return (task->tqent_task.ta_pending == 0);
}

void
taskq_wait(taskq_t *tq)
{
Expand All @@ -439,9 +451,3 @@ taskq_wait_outstanding(taskq_t *tq, taskqid_t id __unused)
{
taskqueue_drain_all(tq->tq_queue);
}

int
taskq_empty_ent(taskq_ent_t *t)
{
return (t->tqent_task.ta_pending == 0);
}