diff --git a/fs/io-wq.c b/fs/io-wq.c index 0596627c1c0b73c7059a4c2fc6e989029e47e3c3..852bedffd5089ccb3001368aae7ca2653e6e5f1f 100644 --- a/fs/io-wq.c +++ b/fs/io-wq.c @@ -1115,6 +1115,14 @@ struct io_wq *io_wq_create(unsigned bounded, struct io_wq_data *data) return ERR_PTR(ret); } +bool io_wq_get(struct io_wq *wq, struct io_wq_data *data) +{ + if (data->get_work != wq->get_work || data->put_work != wq->put_work) + return false; + + return refcount_inc_not_zero(&wq->use_refs); +} + static bool io_wq_worker_wake(struct io_worker *worker, void *data) { wake_up_process(worker->task); diff --git a/fs/io-wq.h b/fs/io-wq.h index 167316ad447ed5b41583840db1653e3a74e4a358..c42602c58c561740e2e89ffeaeb79fc5c1811fea 100644 --- a/fs/io-wq.h +++ b/fs/io-wq.h @@ -99,6 +99,7 @@ struct io_wq_data { }; struct io_wq *io_wq_create(unsigned bounded, struct io_wq_data *data); +bool io_wq_get(struct io_wq *wq, struct io_wq_data *data); void io_wq_destroy(struct io_wq *wq); void io_wq_enqueue(struct io_wq *wq, struct io_wq_work *work);