sunrpc: simplfy sysctl registrations
Subsystems (5)
v3 cover sunrpc: simplfy sysctl registrations
This is my v3 series to simplify sysctl registration for sunrpc. The first series was posted just yesterday [0] but 0-day found an issue with CONFIG_SUNRPC_DEBUG. After this fix I poasted a fix for v2 [1] but alas 0-day then found an issue when CONFIG_SUNRPC_DEBUG is disabled. This fixes both cases... hopefully that's it.
Changes on v3:
o Fix compilation when CONFIG_SUNRPC_DEBUG is disabled.. forgot to keep all the sysctl stuff under the #ifdef.
Changes on v2:
o Fix compilation when CONFIG_SUNRPC_DEBUG is enabled, I forgot to move the proc routines above, and so the 4th patch now does that too.
Feel free to take these patches or let me know and I'm happy to also take these in through sysctl-next. Typically I use sysctl-next for core sysctl changes or for kernel/sysctl.c cleanup to avoid conflicts. All these syctls however are well contained to sunrpc so they can also go in separately. Let me know how you'd like to go about these patches.
[0] https://lkml.kernel.org/r/[email protected]
Luis Chamberlain (5):
sunrpc: simplify two-level sysctl registration for tsvcrdma_parm_table
sunrpc: simplify one-level sysctl registration for xr_tunables_table
sunrpc: simplify one-level sysctl registration for xs_tunables_table
sunrpc: move sunrpc_table and proc routines above
sunrpc: simplify one-level sysctl registration for debug_table
net/sunrpc/sysctl.c | 42 ++++++++++++--------------------- net/sunrpc/xprtrdma/svc_rdma.c | 21 ++--------------- net/sunrpc/xprtrdma/transport.c | 11 +-------- net/sunrpc/xprtsock.c | 13 ++-------- 4 files changed, 20 insertions(+), 67 deletions(-)
Signature · 1 line
2.39.1
PATCH v3 1/5 sunrpc: simplify two-level sysctl registration for tsvcrdma_parm_table
There is no need to declare two tables to just create directories, this can be easily be done with a prefix path with register_sysctl().
Simplify this registration.
--- net/sunrpc/xprtrdma/svc_rdma.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-)
net/sunrpc/xprtrdma/svc_rdma.c +2 -19
@@ -212,24 +212,6 @@ static struct ctl_table svcrdma_parm_table[] = { { }, }; -static struct ctl_table svcrdma_table[] = { - { - .procname ="svc_rdma" , - .mode =0555 , - .child = svcrdma_parm_table - }, - { }, -}; - -static struct ctl_table svcrdma_root_table[] = { - { - .procname ="sunrpc" , - .mode =0555 , - .child = svcrdma_table - }, - { }, -}; -static void svc_rdma_proc_cleanup (void ) {if (!svcrdma_table_header)
@@ -263,7 +245,8 @@ static int svc_rdma_proc_init(void)if (rc) goto out_err; - svcrdma_table_header =register_sysctl_table (svcrdma_root_table); + svcrdma_table_header =register_sysctl ("sunrpc/svc_rdma" , + svcrdma_parm_table);return 0 ; out_err:
Signature · 1 line
2.39.1
Re: [PATCH v3 1/5] sunrpc: simplify two-level sysctl registration for tsvcrdma_parm_table
Quoted 10 lines · Luis Chamberlain
There is no need to declare two tables to just create directories, this can be easily be done with a prefix path with
register_sysctl().Simplify this registration.
Signed-off-by Luis Chamberlain <[email protected]>
I can take this one, but I'm wondering what "tsvcrdma_parm_table" is (see the short description).
Quoted 42 lines
---
net/sunrpc/xprtrdma/svc_rdma.c| 21 ++-------------------1 file changed, 2 insertions(+), 19 deletions(-)net/sunrpc/xprtrdma/svc_rdma.c +2
-19@@ -212,24 +212,6 @@ static struct ctl_table svcrdma_parm_table[] = { { }, }; -static struct ctl_table svcrdma_table[] = { - { - .procname ="svc_rdma" , - .mode =0555 , - .child = svcrdma_parm_table - }, - { }, -}; - -static struct ctl_table svcrdma_root_table[] = { - { - .procname ="sunrpc" , - .mode =0555 , - .child = svcrdma_table - }, - { }, -}; -static void svc_rdma_proc_cleanup (void ) {if (!svcrdma_table_header)@@ -263,7 +245,8 @@ static int svc_rdma_proc_init(void)if (rc) goto out_err; - svcrdma_table_header =register_sysctl_table (svcrdma_root_table); + svcrdma_table_header =register_sysctl ("sunrpc/svc_rdma" , + svcrdma_parm_table);return 0 ;
Quoted 4 lines
out_err:Signature · 1 line
2.39.1
--
Chuck Lever
Re: [PATCH v3 1/5] sunrpc: simplify two-level sysctl registration for tsvcrdma_parm_table
Quoted 7 lines · Chuck Lever III
Quoted 7 lines · Luis Chamberlain
There is no need to declare two tables to just create directories, this can be easily be done with a prefix path with
register_sysctl().
Quoted 6 lines
Quoted 3 lines
Simplify this registration.
Signed-off-by Luis Chamberlain <[email protected]>I can take this one, but I'm wondering what "
tsvcrdma_parm_table" is (see the short description).
Heh sorry tsvcrdma_parm_table was
supposed to be svcrdma_parm_table.
Sorry for the typo.
Can you fix or wuold you like me to resend?
Luis
Re: [PATCH v3 1/5] sunrpc: simplify two-level sysctl registration for tsvcrdma_parm_table
Quoted 19 lines · Luis Chamberlain
Quoted 7 lines · Chuck Lever III
Quoted 7 lines · Luis Chamberlain
There is no need to declare two tables to just create directories, this can be easily be done with a prefix path with
register_sysctl().Quoted 6 lines
Quoted 3 lines
Simplify this registration.
Signed-off-by Luis Chamberlain <[email protected]>I can take this one, but I'm wondering what "
tsvcrdma_parm_table" is (see the short description).
Quoted 6 lines
Heh sorry
tsvcrdma_parm_tablewas
supposed to besvcrdma_parm_table.Sorry for the typo.
Can you fix or wuold you like me to resend?
I'll fix it up, just wanted confirmation that I wasn't missing something important!
--
Chuck Lever
PATCH v3 2/5 sunrpc: simplify one-level sysctl registration for xr_tunables_table
In reply to Luis ChamberlainThere is no need to declare an extra tables to just create directory, this can be easily be done with a prefix path with register_sysctl().
Simplify this registration.
--- net/sunrpc/xprtrdma/transport.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
net/sunrpc/xprtrdma/transport.c +1 -10
@@ -140,15 +140,6 @@ static struct ctl_table xr_tunables_table[] = { { }, }; -static struct ctl_table sunrpc_table[] = { - { - .procname ="sunrpc" , - .mode =0555 , - .child = xr_tunables_table - }, - { }, -}; -#endif static const struct rpc_xprt_ops xprt_rdma_procs;
@@ -799,7 +790,7 @@ int xprt_rdma_init(void)#if IS_ENABLED (CONFIG_SUNRPC_DEBUG )if (!sunrpc_table_header) - sunrpc_table_header =register_sysctl_table (sunrpc_table); + sunrpc_table_header =register_sysctl ("sunrpc" , xr_tunables_table);#endif return 0 ; }
Signature · 1 line
2.39.1
PATCH v3 3/5 sunrpc: simplify one-level sysctl registration for xs_tunables_table
In reply to Luis ChamberlainThere is no need to declare an extra tables to just create directory, this can be easily be done with a prefix path with register_sysctl().
Simplify this registration.
--- net/sunrpc/xprtsock.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
net/sunrpc/xprtsock.c +2 -11
@@ -77,7 +77,7 @@ static unsigned int xs_tcp_fin_timeout __read_mostly = XS_TCP_LINGER_TO;/* * We can register our own files under /proc/sys/sunrpc by -* calling register_sysctl_table() again. The files in that +* calling register_sysctl() again. The files in that * directory become the union of all files registered there. * * We simply need to make sure that we don't collide with
@@ -157,15 +157,6 @@ static struct ctl_table xs_tunables_table[] = { { }, }; -static struct ctl_table sunrpc_table[] = { - { - .procname ="sunrpc" , - .mode =0555 , - .child = xs_tunables_table - }, - { }, -}; -/* * Wait duration for a reply from the RPC portmapper. */
@@ -3174,7 +3165,7 @@ static struct xprt_class xs_bc_tcp_transport = {int init_socket_xprt (void ) {if (!sunrpc_table_header) - sunrpc_table_header =register_sysctl_table (sunrpc_table); + sunrpc_table_header =register_sysctl ("sunrpc" , xs_tunables_table);xprt_register_transport (&xs_local_transport);xprt_register_transport (&xs_udp_transport);
Signature · 1 line
2.39.1
PATCH v3 4/5 sunrpc: move sunrpc_table and proc routines above
In reply to Luis ChamberlainNo need to do a forward declaration for sunrpc_table, just move the sysctls up as everyone else does it. This will make the next change easier to read. This change produces no functional changes.
--- net/sunrpc/sysctl.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-)
net/sunrpc/sysctl.c +16 -19
@@ -40,25 +40,6 @@ EXPORT_SYMBOL_GPL(nlm_debug);#if IS_ENABLED (CONFIG_SUNRPC_DEBUG ) -static struct ctl_table_header *sunrpc_table_header; -static struct ctl_table sunrpc_table[]; - -void -rpc_register_sysctl (void ) -{ -if (!sunrpc_table_header) - sunrpc_table_header =register_sysctl_table (sunrpc_table); -} - -void -rpc_unregister_sysctl (void ) -{ -if (sunrpc_table_header) { -unregister_sysctl_table (sunrpc_table_header); - sunrpc_table_header =NULL ; - } -} -static int proc_do_xprt (struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {
@@ -142,6 +123,7 @@ proc_dodebug(struct ctl_table *table, int write, void *buffer, size_t *lenp,return 0 ; } +static struct ctl_table_header *sunrpc_table_header;static struct ctl_table debug_table[] = { {
@@ -190,4 +172,19 @@ static struct ctl_table sunrpc_table[] = { { } }; +void +rpc_register_sysctl (void ) +{ +if (!sunrpc_table_header) + sunrpc_table_header =register_sysctl_table (sunrpc_table); +} + +void +rpc_unregister_sysctl (void ) +{ +if (sunrpc_table_header) { +unregister_sysctl_table (sunrpc_table_header); + sunrpc_table_header =NULL ; + } +}#endif
Signature · 1 line
2.39.1
PATCH v3 5/5 sunrpc: simplify one-level sysctl registration for debug_table
In reply to Luis ChamberlainThere is no need to declare an extra tables to just create directory, this can be easily be done with a prefix path with register_sysctl().
Simplify this registration.
--- net/sunrpc/sysctl.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
net/sunrpc/sysctl.c +1 -10
@@ -163,20 +163,11 @@ static struct ctl_table debug_table[] = { { } }; -static struct ctl_table sunrpc_table[] = { - { - .procname ="sunrpc" , - .mode =0555 , - .child = debug_table - }, - { } -}; -void rpc_register_sysctl (void ) {if (!sunrpc_table_header) - sunrpc_table_header =register_sysctl_table (sunrpc_table); + sunrpc_table_header =register_sysctl ("sunrpc" , debug_table); }void
Signature · 1 line
2.39.1
Quoted 31 lines · Luis Chamberlain
This is my v3 series to simplify sysctl registration for sunrpc. The first series was posted just yesterday [0] but 0-day found an issue with
CONFIG_SUNRPC_DEBUG. After this fix I poasted a fix for v2 [1] but alas 0-day then found an issue whenCONFIG_SUNRPC_DEBUGis disabled. This fixes both cases... hopefully that's it.Changes on v3:
o Fix compilation when
CONFIG_SUNRPC_DEBUGis disabled.. forgot to keep all the sysctl stuff under the #ifdef.Changes on v2:
o Fix compilation when
CONFIG_SUNRPC_DEBUGis enabled, I forgot to move the proc routines above, and so the 4th patch now does that too.Feel free to take these patches or let me know and I'm happy to also take these in through sysctl-next. Typically I use sysctl-next for core sysctl changes or for
kernel/sysctl.ccleanup to avoid conflicts. All these syctls however are well contained to sunrpc so they can also go in separately. Let me know how you'd like to go about these patches.[0] https://lkml.kernel.org/r/[email protected]
Luis Chamberlain (5):
sunrpc: simplify two-level sysctl registration fortsvcrdma_parm_table
sunrpc: simplify one-level sysctl registration forxr_tunables_table
sunrpc: simplify one-level sysctl registration forxs_tunables_table
sunrpc: movesunrpc_tableand proc routines above
sunrpc: simplify one-level sysctl registration fordebug_table
Quoted 6 lines
net/sunrpc/sysctl.c | 42 ++++++++++++--------------------- net/sunrpc/xprtrdma/svc_rdma.c | 21 ++--------------- net/sunrpc/xprtrdma/transport.c | 11 +-------- net/sunrpc/xprtsock.c | 13 ++-------- 4 files changed, 20 insertions(+), 67 deletions(-)
Nice little cleanup.