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

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>

authored by

Kefeng Wang and committed by
Jan Kara
5a6cb47e 4cece764

+4 -5
+4 -5
fs/quota/dquot.c
··· 3016 3016 if (!dquot_hash) 3017 3017 panic("Cannot create dquot hash table"); 3018 3018 3019 - for (i = 0; i < _DQST_DQSTAT_LAST; i++) { 3020 - ret = percpu_counter_init(&dqstats.counter[i], 0, GFP_KERNEL); 3021 - if (ret) 3022 - panic("Cannot create dquot stat counters"); 3023 - } 3019 + ret = percpu_counter_init_many(dqstats.counter, 0, GFP_KERNEL, 3020 + _DQST_DQSTAT_LAST); 3021 + if (ret) 3022 + panic("Cannot create dquot stat counters"); 3024 3023 3025 3024 /* Find power-of-two hlist_heads which can fit into allocation */ 3026 3025 nr_hash = (1UL << order) * PAGE_SIZE / sizeof(struct hlist_head);