diff options
author | Kefeng Wang <wangkefeng.wang@huawei.com> | 2024-03-25 07:12:40 +0300 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2024-03-25 22:09:17 +0300 |
commit | 5a6cb47ef05a48cec778207fff6c189de8f27a0e (patch) | |
tree | a7673b9ec41f0aae77a9ae2b215057f18a0f094e /fs/quota | |
parent | 4cece764965020c22cff7665b18a012006359095 (diff) | |
download | linux-5a6cb47ef05a48cec778207fff6c189de8f27a0e.tar.xz |
fs: quota: use group allocation of per-cpu counters API
Use group allocation of per-cpu counters api to accelerate
dquot_init() and simplify code.
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Message-Id: <20240325041240.53537-1-wangkefeng.wang@huawei.com>
Diffstat (limited to 'fs/quota')
-rw-r--r-- | fs/quota/dquot.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index dacbee455c03..808544f74e5e 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -3016,11 +3016,10 @@ static int __init dquot_init(void) if (!dquot_hash) panic("Cannot create dquot hash table"); - for (i = 0; i < _DQST_DQSTAT_LAST; i++) { - ret = percpu_counter_init(&dqstats.counter[i], 0, GFP_KERNEL); - if (ret) - panic("Cannot create dquot stat counters"); - } + ret = percpu_counter_init_many(dqstats.counter, 0, GFP_KERNEL, + _DQST_DQSTAT_LAST); + if (ret) + panic("Cannot create dquot stat counters"); /* Find power-of-two hlist_heads which can fit into allocation */ nr_hash = (1UL << order) * PAGE_SIZE / sizeof(struct hlist_head); |