diff options
author | Kefeng Wang <wangkefeng.wang@huawei.com> | 2024-03-25 21:21:39 +0800 |
---|---|---|
committer | Chuck Lever <chuck.lever@oracle.com> | 2024-05-06 09:07:17 -0400 |
commit | 7d12cce8784c66ad9351e91743cd68a573850732 (patch) | |
tree | 4d10f74878228341f78fc7567c8848d2ad863ebb /fs/nfsd/export.c | |
parent | 33a1e6ea73e5f1defe6706f006c0930a82ebdaaa (diff) | |
download | lwn-7d12cce8784c66ad9351e91743cd68a573850732.tar.gz lwn-7d12cce8784c66ad9351e91743cd68a573850732.zip |
fs: nfsd: use group allocation/free of per-cpu counters API
Use group allocation/free of per-cpu counters api to accelerate
nfsd percpu_counters init/destroy(), and also squash the
nfsd_percpu_counters_init/reset/destroy() and nfsd_counters_init/destroy()
into callers to simplify code.
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'fs/nfsd/export.c')
-rw-r--r-- | fs/nfsd/export.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c index 7b641095a665..50b3135d07ac 100644 --- a/fs/nfsd/export.c +++ b/fs/nfsd/export.c @@ -334,21 +334,25 @@ static void nfsd4_fslocs_free(struct nfsd4_fs_locations *fsloc) static int export_stats_init(struct export_stats *stats) { stats->start_time = ktime_get_seconds(); - return nfsd_percpu_counters_init(stats->counter, EXP_STATS_COUNTERS_NUM); + return percpu_counter_init_many(stats->counter, 0, GFP_KERNEL, + EXP_STATS_COUNTERS_NUM); } static void export_stats_reset(struct export_stats *stats) { - if (stats) - nfsd_percpu_counters_reset(stats->counter, - EXP_STATS_COUNTERS_NUM); + if (stats) { + int i; + + for (i = 0; i < EXP_STATS_COUNTERS_NUM; i++) + percpu_counter_set(&stats->counter[i], 0); + } } static void export_stats_destroy(struct export_stats *stats) { if (stats) - nfsd_percpu_counters_destroy(stats->counter, - EXP_STATS_COUNTERS_NUM); + percpu_counter_destroy_many(stats->counter, + EXP_STATS_COUNTERS_NUM); } static void svc_export_put(struct kref *ref) |