Commit 5a6cb47e authored by Kefeng Wang's avatar Kefeng Wang Committed by Jan Kara
Browse files

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: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Message-Id: <20240325041240.53537-1-wangkefeng.wang@huawei.com>
parent 4cece764
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -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);
	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);