diff mbox series

[v3,1/5] sunrpc: simplify two-level sysctl registration for tsvcrdma_parm_table

Message ID 20230311233944.354858-2-mcgrof@kernel.org (mailing list archive)
State New, archived
Headers show
Series sunrpc: simplfy sysctl registrations | expand

Commit Message

Luis Chamberlain March 11, 2023, 11:39 p.m. UTC
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 <mcgrof@kernel.org>
---
 net/sunrpc/xprtrdma/svc_rdma.c | 21 ++-------------------
 1 file changed, 2 insertions(+), 19 deletions(-)

Comments

Chuck Lever III March 12, 2023, 1:06 a.m. UTC | #1
> On Mar 11, 2023, at 6:39 PM, Luis Chamberlain <mcgrof@kernel.org> wrote:
> 
> 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 <mcgrof@kernel.org>

I can take this one, but I'm wondering what "tsvcrdma_parm_table"
is (see the short description).


> ---
> net/sunrpc/xprtrdma/svc_rdma.c | 21 ++-------------------
> 1 file changed, 2 insertions(+), 19 deletions(-)
> 
> diff --git a/net/sunrpc/xprtrdma/svc_rdma.c b/net/sunrpc/xprtrdma/svc_rdma.c
> index 5bc20e9d09cd..f0d5eeed4c88 100644
> --- a/net/sunrpc/xprtrdma/svc_rdma.c
> +++ b/net/sunrpc/xprtrdma/svc_rdma.c
> @@ -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:
> -- 
> 2.39.1
> 

--
Chuck Lever
Luis Chamberlain March 12, 2023, 1:15 a.m. UTC | #2
On Sun, Mar 12, 2023 at 01:06:26AM +0000, Chuck Lever III wrote:
> 
> 
> > On Mar 11, 2023, at 6:39 PM, Luis Chamberlain <mcgrof@kernel.org> wrote:
> > 
> > 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 <mcgrof@kernel.org>
> 
> 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
Chuck Lever III March 12, 2023, 1:22 a.m. UTC | #3
> On Mar 11, 2023, at 8:15 PM, Luis Chamberlain <mcgrof@kernel.org> wrote:
> 
> On Sun, Mar 12, 2023 at 01:06:26AM +0000, Chuck Lever III wrote:
>> 
>> 
>>> On Mar 11, 2023, at 6:39 PM, Luis Chamberlain <mcgrof@kernel.org> wrote:
>>> 
>>> 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 <mcgrof@kernel.org>
>> 
>> 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?

I'll fix it up, just wanted confirmation that I wasn't missing
something important!

--
Chuck Lever
diff mbox series

Patch

diff --git a/net/sunrpc/xprtrdma/svc_rdma.c b/net/sunrpc/xprtrdma/svc_rdma.c
index 5bc20e9d09cd..f0d5eeed4c88 100644
--- a/net/sunrpc/xprtrdma/svc_rdma.c
+++ b/net/sunrpc/xprtrdma/svc_rdma.c
@@ -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: