X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=workqueue.h;h=1961b2ae8b631eba3d70b5e791e5b6f387a429d0;hp=3119ff1782ad7b4dba99ebfccddcc4965db61d23;hb=364bd3acddf9bf4e6604ae01dd214a743d0d5106;hpb=17ecadc3fababaace961051765f140d3332d362d diff --git a/workqueue.h b/workqueue.h index 3119ff17..1961b2ae 100644 --- a/workqueue.h +++ b/workqueue.h @@ -17,15 +17,16 @@ struct submit_worker { uint64_t seq; struct workqueue *wq; void *private; + struct sk_out *sk_out; }; -typedef void (workqueue_work_fn)(struct submit_worker *, struct workqueue_work *); +typedef int (workqueue_work_fn)(struct submit_worker *, struct workqueue_work *); typedef bool (workqueue_pre_sleep_flush_fn)(struct submit_worker *); typedef void (workqueue_pre_sleep_fn)(struct submit_worker *); typedef int (workqueue_alloc_worker_fn)(struct submit_worker *); typedef void (workqueue_free_worker_fn)(struct submit_worker *); typedef int (workqueue_init_worker_fn)(struct submit_worker *); -typedef void (workqueue_exit_worker_fn)(struct submit_worker *); +typedef void (workqueue_exit_worker_fn)(struct submit_worker *, unsigned int *); typedef void (workqueue_update_acct_fn)(struct submit_worker *); struct workqueue_ops { @@ -40,6 +41,8 @@ struct workqueue_ops { workqueue_init_worker_fn *init_worker_fn; workqueue_exit_worker_fn *exit_worker_fn; + + unsigned int nice; }; struct workqueue { @@ -58,10 +61,10 @@ struct workqueue { volatile int wake_idle; }; -int workqueue_init(struct thread_data *td, struct workqueue *wq, struct workqueue_ops *ops, unsigned int max_workers); +int workqueue_init(struct thread_data *td, struct workqueue *wq, struct workqueue_ops *ops, unsigned int max_workers, struct sk_out *sk_out); void workqueue_exit(struct workqueue *wq); -bool workqueue_enqueue(struct workqueue *wq, struct workqueue_work *work); +void workqueue_enqueue(struct workqueue *wq, struct workqueue_work *work); void workqueue_flush(struct workqueue *wq); static inline bool workqueue_pre_sleep_check(struct submit_worker *sw) @@ -92,13 +95,18 @@ static inline int workqueue_init_worker(struct submit_worker *sw) return wq->ops.init_worker_fn(sw); } -static inline void workqueue_exit_worker(struct submit_worker *sw) +static inline void workqueue_exit_worker(struct submit_worker *sw, + unsigned int *sum_cnt) { struct workqueue *wq = sw->wq; + unsigned int tmp = 1; if (!wq->ops.exit_worker_fn) return; - wq->ops.exit_worker_fn(sw); + if (!sum_cnt) + sum_cnt = &tmp; + + wq->ops.exit_worker_fn(sw, sum_cnt); } #endif