Skip to contentSkip to conversation

nfs/lockd: simplify sysctl registration

PATCH New Luis Chamberlain 2 participants 5 messages Mar 10, 2023 – Mar 13, 2023

Subsystems (3)
lore
Share & tools
lore
#2 lore raw

PATCH 2/3 nfs: simplify two-level sysctl registration for nfs4_cb_sysctls

In reply to 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.

---
 fs/nfs/nfs4sysctl.c | 21 ++-------------------
 1 file changed, 2 insertions(+), 19 deletions(-)
fs/nfs/nfs4sysctl.c +2 -19
index c394e4447100..e776200e9a11 100644
@@ -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;
Signature · 1 line
2.39.1
#0 lore raw

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/[email protected]

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(-)
Signature · 1 line
2.39.1
#3 lore raw

PATCH 3/3 nfs: simplify two-level sysctl registration for nfs_cb_sysctls

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.

---
 fs/nfs/sysctl.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)
fs/nfs/sysctl.c +1 -19
index 7aea195ddb35..f39e2089bc4c 100644
@@ -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;
Signature · 1 line
2.39.1
#1 lore raw

PATCH 1/3 lockd: simplify two-level sysctl registration for nlm_sysctls

In reply to 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.

---
 fs/lockd/svc.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)
fs/lockd/svc.c +1 -19
index 914ea1c3537d..5bca33758bc8 100644
@@ -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
Signature · 1 line
2.39.1
maintainer Reviewed-by
#4 lore raw
In reply to Luis Chamberlain
Quoted 16 lines · 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/[email protected]

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

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