linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* nfs/lockd: simplify sysctl registration
@ 2023-03-10 22:58 Luis Chamberlain
  2023-03-10 22:58 ` [PATCH 1/3] lockd: simplify two-level sysctl registration for nlm_sysctls Luis Chamberlain
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Luis Chamberlain @ 2023-03-10 22:58 UTC (permalink / raw)
  To: chuck.lever, jlayton, trond.myklebust, anna, linux-nfs
  Cc: ebiederm, keescook, yzaikin, j.granados, patches, linux-fsdevel,
	linux-kernel, Luis Chamberlain

This is just following the work of the same sysctl registration [0] I
just emailed you patches for sunprc but for nfs and lockd.

Feel free to pick up or let me know if you want me to take them through
my tree. I haven't even finished compile testing all these yet, but they
are pretty trivial.

I'm just dropping netdev on this series as its purely nfs/lockd stuff.

[0] https://lkml.kernel.org/r/20230310225236.3939443-1-mcgrof@kernel.org

Luis Chamberlain (3):
  lockd: simplify two-level sysctl registration for nlm_sysctls
  nfs: simplify two-level sysctl registration for nfs4_cb_sysctls
  nfs: simplify two-level sysctl registration for nfs_cb_sysctls

 fs/lockd/svc.c      | 20 +-------------------
 fs/nfs/nfs4sysctl.c | 21 ++-------------------
 fs/nfs/sysctl.c     | 20 +-------------------
 3 files changed, 4 insertions(+), 57 deletions(-)

-- 
2.39.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] lockd: simplify two-level sysctl registration for nlm_sysctls
  2023-03-10 22:58 nfs/lockd: simplify sysctl registration Luis Chamberlain
@ 2023-03-10 22:58 ` Luis Chamberlain
  2023-03-10 22:58 ` [PATCH 2/3] nfs: simplify two-level sysctl registration for nfs4_cb_sysctls Luis Chamberlain
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Luis Chamberlain @ 2023-03-10 22:58 UTC (permalink / raw)
  To: chuck.lever, jlayton, trond.myklebust, anna, linux-nfs
  Cc: ebiederm, keescook, yzaikin, j.granados, patches, linux-fsdevel,
	linux-kernel, 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 <mcgrof@kernel.org>
---
 fs/lockd/svc.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index 914ea1c3537d..5bca33758bc8 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -510,24 +510,6 @@ static struct ctl_table nlm_sysctls[] = {
 	{ }
 };
 
-static struct ctl_table nlm_sysctl_dir[] = {
-	{
-		.procname	= "nfs",
-		.mode		= 0555,
-		.child		= nlm_sysctls,
-	},
-	{ }
-};
-
-static struct ctl_table nlm_sysctl_root[] = {
-	{
-		.procname	= "fs",
-		.mode		= 0555,
-		.child		= nlm_sysctl_dir,
-	},
-	{ }
-};
-
 #endif	/* CONFIG_SYSCTL */
 
 /*
@@ -644,7 +626,7 @@ static int __init init_nlm(void)
 
 #ifdef CONFIG_SYSCTL
 	err = -ENOMEM;
-	nlm_sysctl_table = register_sysctl_table(nlm_sysctl_root);
+	nlm_sysctl_table = register_sysctl("fs/nfs", nlm_sysctls);
 	if (nlm_sysctl_table == NULL)
 		goto err_sysctl;
 #endif
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] nfs: simplify two-level sysctl registration for nfs4_cb_sysctls
  2023-03-10 22:58 nfs/lockd: simplify sysctl registration Luis Chamberlain
  2023-03-10 22:58 ` [PATCH 1/3] lockd: simplify two-level sysctl registration for nlm_sysctls Luis Chamberlain
@ 2023-03-10 22:58 ` Luis Chamberlain
  2023-03-10 22:58 ` [PATCH 3/3] nfs: simplify two-level sysctl registration for nfs_cb_sysctls Luis Chamberlain
  2023-03-13 10:49 ` nfs/lockd: simplify sysctl registration Jeff Layton
  3 siblings, 0 replies; 5+ messages in thread
From: Luis Chamberlain @ 2023-03-10 22:58 UTC (permalink / raw)
  To: chuck.lever, jlayton, trond.myklebust, anna, linux-nfs
  Cc: ebiederm, keescook, yzaikin, j.granados, patches, linux-fsdevel,
	linux-kernel, 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 <mcgrof@kernel.org>
---
 fs/nfs/nfs4sysctl.c | 21 ++-------------------
 1 file changed, 2 insertions(+), 19 deletions(-)

diff --git a/fs/nfs/nfs4sysctl.c b/fs/nfs/nfs4sysctl.c
index c394e4447100..e776200e9a11 100644
--- a/fs/nfs/nfs4sysctl.c
+++ b/fs/nfs/nfs4sysctl.c
@@ -37,27 +37,10 @@ static struct ctl_table nfs4_cb_sysctls[] = {
 	{ }
 };
 
-static struct ctl_table nfs4_cb_sysctl_dir[] = {
-	{
-		.procname = "nfs",
-		.mode = 0555,
-		.child = nfs4_cb_sysctls,
-	},
-	{ }
-};
-
-static struct ctl_table nfs4_cb_sysctl_root[] = {
-	{
-		.procname = "fs",
-		.mode = 0555,
-		.child = nfs4_cb_sysctl_dir,
-	},
-	{ }
-};
-
 int nfs4_register_sysctl(void)
 {
-	nfs4_callback_sysctl_table = register_sysctl_table(nfs4_cb_sysctl_root);
+	nfs4_callback_sysctl_table = register_sysctl("fs/nfs",
+						     nfs4_cb_sysctls);
 	if (nfs4_callback_sysctl_table == NULL)
 		return -ENOMEM;
 	return 0;
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] nfs: simplify two-level sysctl registration for nfs_cb_sysctls
  2023-03-10 22:58 nfs/lockd: simplify sysctl registration Luis Chamberlain
  2023-03-10 22:58 ` [PATCH 1/3] lockd: simplify two-level sysctl registration for nlm_sysctls Luis Chamberlain
  2023-03-10 22:58 ` [PATCH 2/3] nfs: simplify two-level sysctl registration for nfs4_cb_sysctls Luis Chamberlain
@ 2023-03-10 22:58 ` Luis Chamberlain
  2023-03-13 10:49 ` nfs/lockd: simplify sysctl registration Jeff Layton
  3 siblings, 0 replies; 5+ messages in thread
From: Luis Chamberlain @ 2023-03-10 22:58 UTC (permalink / raw)
  To: chuck.lever, jlayton, trond.myklebust, anna, linux-nfs
  Cc: ebiederm, keescook, yzaikin, j.granados, patches, linux-fsdevel,
	linux-kernel, 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 <mcgrof@kernel.org>
---
 fs/nfs/sysctl.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

diff --git a/fs/nfs/sysctl.c b/fs/nfs/sysctl.c
index 7aea195ddb35..f39e2089bc4c 100644
--- a/fs/nfs/sysctl.c
+++ b/fs/nfs/sysctl.c
@@ -32,27 +32,9 @@ static struct ctl_table nfs_cb_sysctls[] = {
 	{ }
 };
 
-static struct ctl_table nfs_cb_sysctl_dir[] = {
-	{
-		.procname = "nfs",
-		.mode = 0555,
-		.child = nfs_cb_sysctls,
-	},
-	{ }
-};
-
-static struct ctl_table nfs_cb_sysctl_root[] = {
-	{
-		.procname = "fs",
-		.mode = 0555,
-		.child = nfs_cb_sysctl_dir,
-	},
-	{ }
-};
-
 int nfs_register_sysctl(void)
 {
-	nfs_callback_sysctl_table = register_sysctl_table(nfs_cb_sysctl_root);
+	nfs_callback_sysctl_table = register_sysctl("fs/nfs", nfs_cb_sysctls);
 	if (nfs_callback_sysctl_table == NULL)
 		return -ENOMEM;
 	return 0;
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: nfs/lockd: simplify sysctl registration
  2023-03-10 22:58 nfs/lockd: simplify sysctl registration Luis Chamberlain
                   ` (2 preceding siblings ...)
  2023-03-10 22:58 ` [PATCH 3/3] nfs: simplify two-level sysctl registration for nfs_cb_sysctls Luis Chamberlain
@ 2023-03-13 10:49 ` Jeff Layton
  3 siblings, 0 replies; 5+ messages in thread
From: Jeff Layton @ 2023-03-13 10:49 UTC (permalink / raw)
  To: Luis Chamberlain, chuck.lever, trond.myklebust, anna, linux-nfs
  Cc: ebiederm, keescook, yzaikin, j.granados, patches, linux-fsdevel,
	linux-kernel

On Fri, 2023-03-10 at 14:58 -0800, Luis Chamberlain wrote:
> This is just following the work of the same sysctl registration [0] I
> just emailed you patches for sunprc but for nfs and lockd.
> 
> Feel free to pick up or let me know if you want me to take them through
> my tree. I haven't even finished compile testing all these yet, but they
> are pretty trivial.
> 
> I'm just dropping netdev on this series as its purely nfs/lockd stuff.
> 
> [0] https://lkml.kernel.org/r/20230310225236.3939443-1-mcgrof@kernel.org
> 
> Luis Chamberlain (3):
>   lockd: simplify two-level sysctl registration for nlm_sysctls
>   nfs: simplify two-level sysctl registration for nfs4_cb_sysctls
>   nfs: simplify two-level sysctl registration for nfs_cb_sysctls
> 
>  fs/lockd/svc.c      | 20 +-------------------
>  fs/nfs/nfs4sysctl.c | 21 ++-------------------
>  fs/nfs/sysctl.c     | 20 +-------------------
>  3 files changed, 4 insertions(+), 57 deletions(-)
> 

Reviewed-by: Jeff Layton <jlayton@kernel.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-03-13 10:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-10 22:58 nfs/lockd: simplify sysctl registration Luis Chamberlain
2023-03-10 22:58 ` [PATCH 1/3] lockd: simplify two-level sysctl registration for nlm_sysctls Luis Chamberlain
2023-03-10 22:58 ` [PATCH 2/3] nfs: simplify two-level sysctl registration for nfs4_cb_sysctls Luis Chamberlain
2023-03-10 22:58 ` [PATCH 3/3] nfs: simplify two-level sysctl registration for nfs_cb_sysctls Luis Chamberlain
2023-03-13 10:49 ` nfs/lockd: simplify sysctl registration Jeff Layton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).