Skip to content

Commit 7a842fb

Browse files
Hao Xuaxboe
authored andcommitted
io-wq: code clean of io_wqe_create_worker()
Remove do_create to save a local variable. Signed-off-by: Hao Xu <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 16c8d2d commit 7a842fb

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

fs/io-wq.c

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,6 @@ static bool io_wqe_activate_free_worker(struct io_wqe *wqe,
246246
*/
247247
static bool io_wqe_create_worker(struct io_wqe *wqe, struct io_wqe_acct *acct)
248248
{
249-
bool do_create = false;
250-
251249
/*
252250
* Most likely an attempt to queue unbounded work on an io_wq that
253251
* 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)
256254
pr_warn_once("io-wq is not configured for unbound workers");
257255

258256
raw_spin_lock(&wqe->lock);
259-
if (acct->nr_workers < acct->max_workers) {
260-
acct->nr_workers++;
261-
do_create = true;
257+
if (acct->nr_workers == acct->max_workers) {
258+
raw_spin_unlock(&wqe->lock);
259+
return true;
262260
}
261+
acct->nr_workers++;
263262
raw_spin_unlock(&wqe->lock);
264-
if (do_create) {
265-
atomic_inc(&acct->nr_running);
266-
atomic_inc(&wqe->wq->worker_refs);
267-
return create_io_worker(wqe->wq, wqe, acct->index);
268-
}
269-
270-
return true;
263+
atomic_inc(&acct->nr_running);
264+
atomic_inc(&wqe->wq->worker_refs);
265+
return create_io_worker(wqe->wq, wqe, acct->index);
271266
}
272267

273268
static void io_wqe_inc_running(struct io_worker *worker)

0 commit comments

Comments
 (0)