iolog: replace tp usage with workqueue
[fio.git] / workqueue.h
index d36f4211da71b26bb97826da7665657cbbd9bcd8..69a85128703395ae01031bddf1806d468b65c290 100644 (file)
@@ -19,24 +19,29 @@ struct submit_worker {
        void *private;
 };
 
-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 {
        workqueue_work_fn *fn;
        workqueue_pre_sleep_flush_fn *pre_sleep_flush_fn;
        workqueue_pre_sleep_fn *pre_sleep_fn;
 
+       workqueue_update_acct_fn *update_acct_fn;
+
        workqueue_alloc_worker_fn *alloc_worker_fn;
        workqueue_free_worker_fn *free_worker_fn;
 
        workqueue_init_worker_fn *init_worker_fn;
        workqueue_exit_worker_fn *exit_worker_fn;
+
+       unsigned int nice;
 };
 
 struct workqueue {
@@ -89,13 +94,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