diff options
author | Hao Xu <haoxu@linux.alibaba.com> | 2021-09-11 21:40:50 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-09-13 03:27:47 +0200 |
commit | 7a842fb589e3cdbe205bc16dc37c30cf13383159 (patch) | |
tree | ac05e8d2b091b4a1354c75bcc66a1e491fa1550a /fs/io-wq.c | |
parent | io_uring: ensure symmetry in handling iter types in loop_rw_iter() (diff) | |
download | linux-7a842fb589e3cdbe205bc16dc37c30cf13383159.tar.xz linux-7a842fb589e3cdbe205bc16dc37c30cf13383159.zip |
io-wq: code clean of io_wqe_create_worker()
Remove do_create to save a local variable.
Signed-off-by: Hao Xu <haoxu@linux.alibaba.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io-wq.c')
-rw-r--r-- | fs/io-wq.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/fs/io-wq.c b/fs/io-wq.c index 6c55362c1f99..a1685b40a4bf 100644 --- a/fs/io-wq.c +++ b/fs/io-wq.c @@ -246,8 +246,6 @@ static bool io_wqe_activate_free_worker(struct io_wqe *wqe, */ static bool io_wqe_create_worker(struct io_wqe *wqe, struct io_wqe_acct *acct) { - bool do_create = false; - /* * Most likely an attempt to queue unbounded work on an io_wq that * wasn't setup with any unbounded workers. @@ -256,18 +254,15 @@ static bool io_wqe_create_worker(struct io_wqe *wqe, struct io_wqe_acct *acct) pr_warn_once("io-wq is not configured for unbound workers"); raw_spin_lock(&wqe->lock); - if (acct->nr_workers < acct->max_workers) { - acct->nr_workers++; - do_create = true; + if (acct->nr_workers == acct->max_workers) { + raw_spin_unlock(&wqe->lock); + return true; } + acct->nr_workers++; raw_spin_unlock(&wqe->lock); - if (do_create) { - atomic_inc(&acct->nr_running); - atomic_inc(&wqe->wq->worker_refs); - return create_io_worker(wqe->wq, wqe, acct->index); - } - - return true; + atomic_inc(&acct->nr_running); + atomic_inc(&wqe->wq->worker_refs); + return create_io_worker(wqe->wq, wqe, acct->index); } static void io_wqe_inc_running(struct io_worker *worker) |