File tree Expand file tree Collapse file tree 4 files changed +13
-55
lines changed Expand file tree Collapse file tree 4 files changed +13
-55
lines changed Original file line number Diff line number Diff line change @@ -334,21 +334,25 @@ static void nfsd4_fslocs_free(struct nfsd4_fs_locations *fsloc)
334
334
static int export_stats_init (struct export_stats * stats )
335
335
{
336
336
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 );
338
339
}
339
340
340
341
static void export_stats_reset (struct export_stats * stats )
341
342
{
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
+ }
345
349
}
346
350
347
351
static void export_stats_destroy (struct export_stats * stats )
348
352
{
349
353
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 );
352
356
}
353
357
354
358
static 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)
1672
1672
retval = nfsd_idmap_init (net );
1673
1673
if (retval )
1674
1674
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 );
1676
1677
if (retval )
1677
1678
goto out_repcache_error ;
1678
1679
memset (& nn -> nfsd_svcstats , 0 , sizeof (nn -> nfsd_svcstats ));
@@ -1704,7 +1705,7 @@ static __net_exit void nfsd_net_exit(struct net *net)
1704
1705
struct nfsd_net * nn = net_generic (net , nfsd_net_id );
1705
1706
1706
1707
nfsd_proc_stat_shutdown (net );
1707
- nfsd_stat_counters_destroy (nn );
1708
+ percpu_counter_destroy_many (nn -> counter , NFSD_STATS_COUNTERS_NUM );
1708
1709
nfsd_idmap_shutdown (net );
1709
1710
nfsd_export_shutdown (net );
1710
1711
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)
73
73
74
74
DEFINE_PROC_SHOW_ATTRIBUTE (nfsd );
75
75
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
-
118
76
void nfsd_proc_stat_init (struct net * net )
119
77
{
120
78
struct nfsd_net * nn = net_generic (net , nfsd_net_id );
Original file line number Diff line number Diff line change 10
10
#include <uapi/linux/nfsd/stats.h>
11
11
#include <linux/percpu_counter.h>
12
12
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 );
18
13
void nfsd_proc_stat_init (struct net * net );
19
14
void nfsd_proc_stat_shutdown (struct net * net );
20
15
You can’t perform that action at this time.
0 commit comments