1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright 2023 Red Hat
6 #ifndef VDO_WORK_QUEUE_H
7 #define VDO_WORK_QUEUE_H
9 #include <linux/sched.h> /* for TASK_COMM_LEN */
14 MAX_VDO_WORK_QUEUE_NAME_LEN
= TASK_COMM_LEN
,
17 struct vdo_work_queue_type
{
18 void (*start
)(void *context
);
19 void (*finish
)(void *context
);
20 enum vdo_completion_priority max_priority
;
21 enum vdo_completion_priority default_priority
;
24 struct vdo_completion
;
26 struct vdo_work_queue
;
28 int vdo_make_work_queue(const char *thread_name_prefix
, const char *name
,
29 struct vdo_thread
*owner
, const struct vdo_work_queue_type
*type
,
30 unsigned int thread_count
, void *thread_privates
[],
31 struct vdo_work_queue
**queue_ptr
);
33 void vdo_enqueue_work_queue(struct vdo_work_queue
*queue
, struct vdo_completion
*completion
);
35 void vdo_finish_work_queue(struct vdo_work_queue
*queue
);
37 void vdo_free_work_queue(struct vdo_work_queue
*queue
);
39 void vdo_dump_work_queue(struct vdo_work_queue
*queue
);
41 void vdo_dump_completion_to_buffer(struct vdo_completion
*completion
, char *buffer
,
44 void *vdo_get_work_queue_private_data(void);
45 struct vdo_work_queue
*vdo_get_current_work_queue(void);
46 struct vdo_thread
*vdo_get_work_queue_owner(struct vdo_work_queue
*queue
);
48 bool __must_check
vdo_work_queue_type_is(struct vdo_work_queue
*queue
,
49 const struct vdo_work_queue_type
*type
);
51 #endif /* VDO_WORK_QUEUE_H */