Commit 7a842fb5 authored by Hao Xu's avatar Hao Xu Committed by Jens Axboe

io-wq: code clean of io_wqe_create_worker()

Remove do_create to save a local variable.
Signed-off-by: default avatarHao Xu <haoxu@linux.alibaba.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 16c8d2df
...@@ -246,8 +246,6 @@ static bool io_wqe_activate_free_worker(struct io_wqe *wqe, ...@@ -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) 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 * Most likely an attempt to queue unbounded work on an io_wq that
* wasn't setup with any unbounded workers. * 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) ...@@ -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"); pr_warn_once("io-wq is not configured for unbound workers");
raw_spin_lock(&wqe->lock); raw_spin_lock(&wqe->lock);
if (acct->nr_workers < acct->max_workers) { if (acct->nr_workers == acct->max_workers) {
acct->nr_workers++; raw_spin_unlock(&wqe->lock);
do_create = true; return true;
} }
acct->nr_workers++;
raw_spin_unlock(&wqe->lock); raw_spin_unlock(&wqe->lock);
if (do_create) { atomic_inc(&acct->nr_running);
atomic_inc(&acct->nr_running); atomic_inc(&wqe->wq->worker_refs);
atomic_inc(&wqe->wq->worker_refs); return create_io_worker(wqe->wq, wqe, acct->index);
return create_io_worker(wqe->wq, wqe, acct->index);
}
return true;
} }
static void io_wqe_inc_running(struct io_worker *worker) static void io_wqe_inc_running(struct io_worker *worker)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment