rate-submit: clean up init/exit helpers
[fio.git] / rate-submit.c
index 3d35815212f5e1ca67b1b79990d78abf90579241..39b552d47927a40f4d910f249dabe5265bdd29fc 100644 (file)
@@ -224,7 +224,7 @@ static void io_workqueue_update_acct_fn(struct submit_worker *sw)
 
 }
 
 
 }
 
-struct workqueue_ops rated_wq_ops = {
+static struct workqueue_ops rated_wq_ops = {
        .fn                     = io_workqueue_fn,
        .pre_sleep_flush_fn     = io_workqueue_pre_sleep_flush_fn,
        .pre_sleep_fn           = io_workqueue_pre_sleep_fn,
        .fn                     = io_workqueue_fn,
        .pre_sleep_flush_fn     = io_workqueue_pre_sleep_flush_fn,
        .pre_sleep_fn           = io_workqueue_pre_sleep_fn,
@@ -234,3 +234,19 @@ struct workqueue_ops rated_wq_ops = {
        .init_worker_fn         = io_workqueue_init_worker_fn,
        .exit_worker_fn         = io_workqueue_exit_worker_fn,
 };
        .init_worker_fn         = io_workqueue_init_worker_fn,
        .exit_worker_fn         = io_workqueue_exit_worker_fn,
 };
+
+int rate_submit_init(struct thread_data *td)
+{
+       if (td->o.io_submit_mode != IO_MODE_OFFLOAD)
+               return 0;
+
+       return workqueue_init(td, &td->io_wq, &rated_wq_ops, td->o.iodepth);
+}
+
+void rate_submit_exit(struct thread_data *td)
+{
+       if (td->o.io_submit_mode != IO_MODE_OFFLOAD)
+               return;
+
+       workqueue_exit(&td->io_wq);
+}