Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Hao Xu and committed by
Jens Axboe
7a842fb5 16c8d2df

+7 -12
+7 -12
fs/io-wq.c
··· 246 246 */ 247 247 static bool io_wqe_create_worker(struct io_wqe *wqe, struct io_wqe_acct *acct) 248 248 { 249 - bool do_create = false; 250 - 251 249 /* 252 250 * Most likely an attempt to queue unbounded work on an io_wq that 253 251 * wasn't setup with any unbounded workers. ··· 254 256 pr_warn_once("io-wq is not configured for unbound workers"); 255 257 256 258 raw_spin_lock(&wqe->lock); 257 - if (acct->nr_workers < acct->max_workers) { 258 - acct->nr_workers++; 259 - do_create = true; 259 + if (acct->nr_workers == acct->max_workers) { 260 + raw_spin_unlock(&wqe->lock); 261 + return true; 260 262 } 263 + acct->nr_workers++; 261 264 raw_spin_unlock(&wqe->lock); 262 - if (do_create) { 263 - atomic_inc(&acct->nr_running); 264 - atomic_inc(&wqe->wq->worker_refs); 265 - return create_io_worker(wqe->wq, wqe, acct->index); 266 - } 267 - 268 - return true; 265 + atomic_inc(&acct->nr_running); 266 + atomic_inc(&wqe->wq->worker_refs); 267 + return create_io_worker(wqe->wq, wqe, acct->index); 269 268 } 270 269 271 270 static void io_wqe_inc_running(struct io_worker *worker)