File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -334,21 +334,25 @@ static void nfsd4_fslocs_free(struct nfsd4_fs_locations *fsloc)
334334static int export_stats_init (struct export_stats * stats )
335335{
336336 stats -> start_time = ktime_get_seconds ();
337- return nfsd_percpu_counters_init (stats -> counter , EXP_STATS_COUNTERS_NUM );
337+ return percpu_counter_init_many (stats -> counter , 0 , GFP_KERNEL ,
338+ EXP_STATS_COUNTERS_NUM );
338339}
339340
340341static void export_stats_reset (struct export_stats * stats )
341342{
342- if (stats )
343- nfsd_percpu_counters_reset (stats -> counter ,
344- EXP_STATS_COUNTERS_NUM );
343+ if (stats ) {
344+ int i ;
345+
346+ for (i = 0 ; i < EXP_STATS_COUNTERS_NUM ; i ++ )
347+ percpu_counter_set (& stats -> counter [i ], 0 );
348+ }
345349}
346350
347351static void export_stats_destroy (struct export_stats * stats )
348352{
349353 if (stats )
350- nfsd_percpu_counters_destroy (stats -> counter ,
351- EXP_STATS_COUNTERS_NUM );
354+ percpu_counter_destroy_many (stats -> counter ,
355+ EXP_STATS_COUNTERS_NUM );
352356}
353357
354358static void svc_export_put (struct kref * ref )
Original file line number Diff line number Diff line change @@ -1672,7 +1672,8 @@ static __net_init int nfsd_net_init(struct net *net)
16721672 retval = nfsd_idmap_init (net );
16731673 if (retval )
16741674 goto out_idmap_error ;
1675- retval = nfsd_stat_counters_init (nn );
1675+ retval = percpu_counter_init_many (nn -> counter , 0 , GFP_KERNEL ,
1676+ NFSD_STATS_COUNTERS_NUM );
16761677 if (retval )
16771678 goto out_repcache_error ;
16781679 memset (& nn -> nfsd_svcstats , 0 , sizeof (nn -> nfsd_svcstats ));
@@ -1704,7 +1705,7 @@ static __net_exit void nfsd_net_exit(struct net *net)
17041705 struct nfsd_net * nn = net_generic (net , nfsd_net_id );
17051706
17061707 nfsd_proc_stat_shutdown (net );
1707- nfsd_stat_counters_destroy (nn );
1708+ percpu_counter_destroy_many (nn -> counter , NFSD_STATS_COUNTERS_NUM );
17081709 nfsd_idmap_shutdown (net );
17091710 nfsd_export_shutdown (net );
17101711 nfsd_netns_free_versions (nn );
Original file line number Diff line number Diff line change @@ -73,48 +73,6 @@ static int nfsd_show(struct seq_file *seq, void *v)
7373
7474DEFINE_PROC_SHOW_ATTRIBUTE (nfsd );
7575
76- int nfsd_percpu_counters_init (struct percpu_counter * counters , int num )
77- {
78- int i , err = 0 ;
79-
80- for (i = 0 ; !err && i < num ; i ++ )
81- err = percpu_counter_init (& counters [i ], 0 , GFP_KERNEL );
82-
83- if (!err )
84- return 0 ;
85-
86- for (; i > 0 ; i -- )
87- percpu_counter_destroy (& counters [i - 1 ]);
88-
89- return err ;
90- }
91-
92- void nfsd_percpu_counters_reset (struct percpu_counter counters [], int num )
93- {
94- int i ;
95-
96- for (i = 0 ; i < num ; i ++ )
97- percpu_counter_set (& counters [i ], 0 );
98- }
99-
100- void nfsd_percpu_counters_destroy (struct percpu_counter counters [], int num )
101- {
102- int i ;
103-
104- for (i = 0 ; i < num ; i ++ )
105- percpu_counter_destroy (& counters [i ]);
106- }
107-
108- int nfsd_stat_counters_init (struct nfsd_net * nn )
109- {
110- return nfsd_percpu_counters_init (nn -> counter , NFSD_STATS_COUNTERS_NUM );
111- }
112-
113- void nfsd_stat_counters_destroy (struct nfsd_net * nn )
114- {
115- nfsd_percpu_counters_destroy (nn -> counter , NFSD_STATS_COUNTERS_NUM );
116- }
117-
11876void nfsd_proc_stat_init (struct net * net )
11977{
12078 struct nfsd_net * nn = net_generic (net , nfsd_net_id );
Original file line number Diff line number Diff line change 1010#include <uapi/linux/nfsd/stats.h>
1111#include <linux/percpu_counter.h>
1212
13- int nfsd_percpu_counters_init (struct percpu_counter * counters , int num );
14- void nfsd_percpu_counters_reset (struct percpu_counter * counters , int num );
15- void nfsd_percpu_counters_destroy (struct percpu_counter * counters , int num );
16- int nfsd_stat_counters_init (struct nfsd_net * nn );
17- void nfsd_stat_counters_destroy (struct nfsd_net * nn );
1813void nfsd_proc_stat_init (struct net * net );
1914void nfsd_proc_stat_shutdown (struct net * net );
2015
You can’t perform that action at this time.
0 commit comments