aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-05-08 17:40:27 -0400
committerChristoph Hellwig <hch@lst.de>2017-05-15 11:42:30 -0400
commit7fd38af9cae6aef1dfd28a7d1bd214eb5ddb7d53 (patch)
tree394d5e146fc57c81264231b0ee58e5a23379f6ea
parenteb69853da9459280d89876cfc3da11292e59f7af (diff)
sunrpc: move pc_count out of struct svc_procinfo
pc_count is the only writeable memeber of struct svc_procinfo, which is a good candidate to be const-ified as it contains function pointers. This patch moves it into out out struct svc_procinfo, and into a separate writable array that is pointed to by struct svc_version. Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r--fs/lockd/svc.c6
-rw-r--r--fs/nfs/callback_xdr.c4
-rw-r--r--fs/nfsd/nfs2acl.c2
-rw-r--r--fs/nfsd/nfs3acl.c2
-rw-r--r--fs/nfsd/nfs3proc.c2
-rw-r--r--fs/nfsd/nfs4proc.c2
-rw-r--r--fs/nfsd/nfsproc.c2
-rw-r--r--include/linux/sunrpc/svc.h2
-rw-r--r--net/sunrpc/stats.c11
-rw-r--r--net/sunrpc/svc.c2
10 files changed, 28 insertions, 7 deletions
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index 5d481e8a1b5d..cc6abe6280bc 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -739,23 +739,29 @@ module_exit(exit_nlm);
739/* 739/*
740 * Define NLM program and procedures 740 * Define NLM program and procedures
741 */ 741 */
742static unsigned int nlmsvc_version1_count[17];
742static struct svc_version nlmsvc_version1 = { 743static struct svc_version nlmsvc_version1 = {
743 .vs_vers = 1, 744 .vs_vers = 1,
744 .vs_nproc = 17, 745 .vs_nproc = 17,
745 .vs_proc = nlmsvc_procedures, 746 .vs_proc = nlmsvc_procedures,
747 .vs_count = nlmsvc_version1_count,
746 .vs_xdrsize = NLMSVC_XDRSIZE, 748 .vs_xdrsize = NLMSVC_XDRSIZE,
747}; 749};
750static unsigned int nlmsvc_version3_count[24];
748static struct svc_version nlmsvc_version3 = { 751static struct svc_version nlmsvc_version3 = {
749 .vs_vers = 3, 752 .vs_vers = 3,
750 .vs_nproc = 24, 753 .vs_nproc = 24,
751 .vs_proc = nlmsvc_procedures, 754 .vs_proc = nlmsvc_procedures,
755 .vs_count = nlmsvc_version3_count,
752 .vs_xdrsize = NLMSVC_XDRSIZE, 756 .vs_xdrsize = NLMSVC_XDRSIZE,
753}; 757};
754#ifdef CONFIG_LOCKD_V4 758#ifdef CONFIG_LOCKD_V4
759static unsigned int nlmsvc_version4_count[24];
755static struct svc_version nlmsvc_version4 = { 760static struct svc_version nlmsvc_version4 = {
756 .vs_vers = 4, 761 .vs_vers = 4,
757 .vs_nproc = 24, 762 .vs_nproc = 24,
758 .vs_proc = nlmsvc_procedures4, 763 .vs_proc = nlmsvc_procedures4,
764 .vs_count = nlmsvc_version4_count,
759 .vs_xdrsize = NLMSVC_XDRSIZE, 765 .vs_xdrsize = NLMSVC_XDRSIZE,
760}; 766};
761#endif 767#endif
diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
index acf75dc63e14..ecd46b8c0985 100644
--- a/fs/nfs/callback_xdr.c
+++ b/fs/nfs/callback_xdr.c
@@ -1011,20 +1011,24 @@ static struct svc_procedure nfs4_callback_procedures1[] = {
1011 } 1011 }
1012}; 1012};
1013 1013
1014static unsigned int nfs4_callback_count1[ARRAY_SIZE(nfs4_callback_procedures1)];
1014struct svc_version nfs4_callback_version1 = { 1015struct svc_version nfs4_callback_version1 = {
1015 .vs_vers = 1, 1016 .vs_vers = 1,
1016 .vs_nproc = ARRAY_SIZE(nfs4_callback_procedures1), 1017 .vs_nproc = ARRAY_SIZE(nfs4_callback_procedures1),
1017 .vs_proc = nfs4_callback_procedures1, 1018 .vs_proc = nfs4_callback_procedures1,
1019 .vs_count = nfs4_callback_count1,
1018 .vs_xdrsize = NFS4_CALLBACK_XDRSIZE, 1020 .vs_xdrsize = NFS4_CALLBACK_XDRSIZE,
1019 .vs_dispatch = NULL, 1021 .vs_dispatch = NULL,
1020 .vs_hidden = true, 1022 .vs_hidden = true,
1021 .vs_need_cong_ctrl = true, 1023 .vs_need_cong_ctrl = true,
1022}; 1024};
1023 1025
1026static unsigned int nfs4_callback_count4[ARRAY_SIZE(nfs4_callback_procedures1)];
1024struct svc_version nfs4_callback_version4 = { 1027struct svc_version nfs4_callback_version4 = {
1025 .vs_vers = 4, 1028 .vs_vers = 4,
1026 .vs_nproc = ARRAY_SIZE(nfs4_callback_procedures1), 1029 .vs_nproc = ARRAY_SIZE(nfs4_callback_procedures1),
1027 .vs_proc = nfs4_callback_procedures1, 1030 .vs_proc = nfs4_callback_procedures1,
1031 .vs_count = nfs4_callback_count4,
1028 .vs_xdrsize = NFS4_CALLBACK_XDRSIZE, 1032 .vs_xdrsize = NFS4_CALLBACK_XDRSIZE,
1029 .vs_dispatch = NULL, 1033 .vs_dispatch = NULL,
1030 .vs_hidden = true, 1034 .vs_hidden = true,
diff --git a/fs/nfsd/nfs2acl.c b/fs/nfsd/nfs2acl.c
index fc6b179c8fff..026edfe73fd5 100644
--- a/fs/nfsd/nfs2acl.c
+++ b/fs/nfsd/nfs2acl.c
@@ -378,10 +378,12 @@ static struct svc_procedure nfsd_acl_procedures2[] = {
378 PROC(access, access, access, access, RC_NOCACHE, ST+AT+1), 378 PROC(access, access, access, access, RC_NOCACHE, ST+AT+1),
379}; 379};
380 380
381static unsigned int nfsd_acl_count2[ARRAY_SIZE(nfsd_acl_procedures2)];
381struct svc_version nfsd_acl_version2 = { 382struct svc_version nfsd_acl_version2 = {
382 .vs_vers = 2, 383 .vs_vers = 2,
383 .vs_nproc = 5, 384 .vs_nproc = 5,
384 .vs_proc = nfsd_acl_procedures2, 385 .vs_proc = nfsd_acl_procedures2,
386 .vs_count = nfsd_acl_count2,
385 .vs_dispatch = nfsd_dispatch, 387 .vs_dispatch = nfsd_dispatch,
386 .vs_xdrsize = NFS3_SVC_XDRSIZE, 388 .vs_xdrsize = NFS3_SVC_XDRSIZE,
387}; 389};
diff --git a/fs/nfsd/nfs3acl.c b/fs/nfsd/nfs3acl.c
index 9437b758cbfd..73c0970ccefb 100644
--- a/fs/nfsd/nfs3acl.c
+++ b/fs/nfsd/nfs3acl.c
@@ -263,10 +263,12 @@ static struct svc_procedure nfsd_acl_procedures3[] = {
263 PROC(setacl, setacl, setacl, fhandle, RC_NOCACHE, ST+pAT), 263 PROC(setacl, setacl, setacl, fhandle, RC_NOCACHE, ST+pAT),
264}; 264};
265 265
266static unsigned int nfsd_acl_count3[ARRAY_SIZE(nfsd_acl_procedures3)];
266struct svc_version nfsd_acl_version3 = { 267struct svc_version nfsd_acl_version3 = {
267 .vs_vers = 3, 268 .vs_vers = 3,
268 .vs_nproc = 3, 269 .vs_nproc = 3,
269 .vs_proc = nfsd_acl_procedures3, 270 .vs_proc = nfsd_acl_procedures3,
271 .vs_count = nfsd_acl_count3,
270 .vs_dispatch = nfsd_dispatch, 272 .vs_dispatch = nfsd_dispatch,
271 .vs_xdrsize = NFS3_SVC_XDRSIZE, 273 .vs_xdrsize = NFS3_SVC_XDRSIZE,
272}; 274};
diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index 17c90c41a3a6..b5823802e278 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -890,10 +890,12 @@ static struct svc_procedure nfsd_procedures3[22] = {
890 }, 890 },
891}; 891};
892 892
893static unsigned int nfsd_count3[ARRAY_SIZE(nfsd_procedures3)];
893struct svc_version nfsd_version3 = { 894struct svc_version nfsd_version3 = {
894 .vs_vers = 3, 895 .vs_vers = 3,
895 .vs_nproc = 22, 896 .vs_nproc = 22,
896 .vs_proc = nfsd_procedures3, 897 .vs_proc = nfsd_procedures3,
898 .vs_count = nfsd_count3,
897 .vs_dispatch = nfsd_dispatch, 899 .vs_dispatch = nfsd_dispatch,
898 .vs_xdrsize = NFS3_SVC_XDRSIZE, 900 .vs_xdrsize = NFS3_SVC_XDRSIZE,
899}; 901};
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index a947dcef5e4e..bad5fec0ebc7 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -2554,10 +2554,12 @@ static struct svc_procedure nfsd_procedures4[2] = {
2554 }, 2554 },
2555}; 2555};
2556 2556
2557static unsigned int nfsd_count3[ARRAY_SIZE(nfsd_procedures4)];
2557struct svc_version nfsd_version4 = { 2558struct svc_version nfsd_version4 = {
2558 .vs_vers = 4, 2559 .vs_vers = 4,
2559 .vs_nproc = 2, 2560 .vs_nproc = 2,
2560 .vs_proc = nfsd_procedures4, 2561 .vs_proc = nfsd_procedures4,
2562 .vs_count = nfsd_count3,
2561 .vs_dispatch = nfsd_dispatch, 2563 .vs_dispatch = nfsd_dispatch,
2562 .vs_xdrsize = NFS4_SVC_XDRSIZE, 2564 .vs_xdrsize = NFS4_SVC_XDRSIZE,
2563 .vs_rpcb_optnl = true, 2565 .vs_rpcb_optnl = true,
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
index 0ef88d0e67d9..44b157553733 100644
--- a/fs/nfsd/nfsproc.c
+++ b/fs/nfsd/nfsproc.c
@@ -743,10 +743,12 @@ static struct svc_procedure nfsd_procedures2[18] = {
743}; 743};
744 744
745 745
746static unsigned int nfsd_count2[ARRAY_SIZE(nfsd_procedures2)];
746struct svc_version nfsd_version2 = { 747struct svc_version nfsd_version2 = {
747 .vs_vers = 2, 748 .vs_vers = 2,
748 .vs_nproc = 18, 749 .vs_nproc = 18,
749 .vs_proc = nfsd_procedures2, 750 .vs_proc = nfsd_procedures2,
751 .vs_count = nfsd_count2,
750 .vs_dispatch = nfsd_dispatch, 752 .vs_dispatch = nfsd_dispatch,
751 .vs_xdrsize = NFS2_SVC_XDRSIZE, 753 .vs_xdrsize = NFS2_SVC_XDRSIZE,
752}; 754};
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 6cfe41db7f31..9f00384153f4 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -397,6 +397,7 @@ struct svc_version {
397 u32 vs_vers; /* version number */ 397 u32 vs_vers; /* version number */
398 u32 vs_nproc; /* number of procedures */ 398 u32 vs_nproc; /* number of procedures */
399 struct svc_procedure * vs_proc; /* per-procedure info */ 399 struct svc_procedure * vs_proc; /* per-procedure info */
400 unsigned int *vs_count; /* call counts */
400 u32 vs_xdrsize; /* xdrsize needed for this version */ 401 u32 vs_xdrsize; /* xdrsize needed for this version */
401 402
402 /* Don't register with rpcbind */ 403 /* Don't register with rpcbind */
@@ -429,7 +430,6 @@ struct svc_procedure {
429 void (*pc_release)(struct svc_rqst *); 430 void (*pc_release)(struct svc_rqst *);
430 unsigned int pc_argsize; /* argument struct size */ 431 unsigned int pc_argsize; /* argument struct size */
431 unsigned int pc_ressize; /* result struct size */ 432 unsigned int pc_ressiz