]>
git.proxmox.com Git - mirror_zfs.git/blob - include/spl-taskq.h
9 * Task Queues - As of linux 2.6.x task queues have been replaced by a
10 * similar construct called work queues. The big difference on the linux
11 * side is that functions called from work queues run in process context
12 * and not interrupt context.
14 * One nice feature of Solaris which does not exist in linux work
15 * queues in the notion of a dynamic work queue. Rather than implementing
16 * this in the shim layer I'm hardcoding one-thread per work queue.
18 * XXX - This may end up being a significant performance penalty which
19 * forces us to implement dynamic workqueues. Which is all very doable
20 * with a little effort.
22 #include <linux/module.h>
23 #include <linux/workqueue.h>
24 #include <linux/gfp.h>
25 #include <linux/slab.h>
26 #include <linux/interrupt.h>
27 #include "spl-types.h"
29 #undef DEBUG_TASKQ_UNIMPLEMENTED
31 #define TASKQ_NAMELEN 31
32 #define taskq_t workq_t
34 typedef struct workqueue_struct workq_t
;
35 typedef unsigned long taskqid_t
;
36 typedef void (*task_func_t
)(void *);
39 * Public flags for taskq_create(): bit range 0-15
41 #define TASKQ_PREPOPULATE 0x0000 /* XXX - Workqueues fully populate */
42 #define TASKQ_CPR_SAFE 0x0000 /* XXX - No analog */
43 #define TASKQ_DYNAMIC 0x0000 /* XXX - Worksqueues not dynamic */
46 * Flags for taskq_dispatch. TQ_SLEEP/TQ_NOSLEEP should be same as
47 * KM_SLEEP/KM_NOSLEEP.
49 #define TQ_SLEEP 0x00 /* XXX - Workqueues don't support */
50 #define TQ_NOSLEEP 0x00 /* these sorts of flags. They */
51 #define TQ_NOQUEUE 0x00 /* always run in application */
52 #define TQ_NOALLOC 0x00 /* context and can sleep. */
55 #ifdef DEBUG_TASKQ_UNIMPLEMENTED
56 static __inline__
void taskq_init(void) {
57 #error "taskq_init() not implemented"
60 static __inline__ taskq_t
*
61 taskq_create_instance(const char *, int, int, pri_t
, int, int, uint_t
) {
62 #error "taskq_create_instance() not implemented"
65 extern void nulltask(void *);
66 extern void taskq_suspend(taskq_t
*);
67 extern int taskq_suspended(taskq_t
*);
68 extern void taskq_resume(taskq_t
*);
70 #endif /* DEBUG_TASKQ_UNIMPLEMENTED */
72 extern taskqid_t
__taskq_dispatch(taskq_t
*, task_func_t
, void *, uint_t
);
73 extern taskq_t
*__taskq_create(const char *, int, pri_t
, int, int, uint_t
);
75 #define taskq_create(name, thr, pri, min, max, flags) \
76 __taskq_create(name, thr, pri, min, max, flags)
77 #define taskq_dispatch(tq, func, priv, flags) \
78 __taskq_dispatch(tq, func, priv, flags)
79 #define taskq_destory(tq) destroy_workqueue(tq)
80 #define taskq_wait(tq) flush_workqueue(tq)
81 #define taskq_member(tq, kthr) 1 /* XXX -Just be true */
87 #endif /* _SPL_TASKQ_H */