aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHao Xu <[email protected]>2022-02-06 17:52:41 +0800
committerJens Axboe <[email protected]>2022-03-10 06:32:49 -0700
commit86127bb18aea7e553cfd0842bcd33a6dc80bfbc8 (patch)
treecdc41b97b40b80941dc69f1e261b1205681e8124
parente13fb1fe1483f6cd6452f25b866ffadf5ee0eff6 (diff)
io-wq: use IO_WQ_ACCT_NR rather than hardcoded number
It's better to use the defined enum stuff not the hardcoded number to define array. Signed-off-by: Hao Xu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
-rw-r--r--fs/io-wq.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/io-wq.c b/fs/io-wq.c
index f7b7fa396faf..5b93fa67d346 100644
--- a/fs/io-wq.c
+++ b/fs/io-wq.c
@@ -92,7 +92,7 @@ enum {
*/
struct io_wqe {
raw_spinlock_t lock;
- struct io_wqe_acct acct[2];
+ struct io_wqe_acct acct[IO_WQ_ACCT_NR];
int node;
@@ -1376,7 +1376,7 @@ int io_wq_max_workers(struct io_wq *wq, int *new_count)
BUILD_BUG_ON((int) IO_WQ_ACCT_UNBOUND != (int) IO_WQ_UNBOUND);
BUILD_BUG_ON((int) IO_WQ_ACCT_NR != 2);
- for (i = 0; i < 2; i++) {
+ for (i = 0; i < IO_WQ_ACCT_NR; i++) {
if (new_count[i] > task_rlimit(current, RLIMIT_NPROC))
new_count[i] = task_rlimit(current, RLIMIT_NPROC);
}