2023-03-10 22:58:53

by Luis Chamberlain

[permalink] [raw]
Subject: nfs/lockd: simplify sysctl registration

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(-)

--
2.39.1



2023-03-10 22:58:53

by Luis Chamberlain

[permalink] [raw]
Subject: [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.

Signed-off-by: Luis Chamberlain <[email protected]>
---
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


2023-03-10 22:58:54

by Luis Chamberlain

[permalink] [raw]
Subject: [PATCH 1/3] lockd: simplify two-level sysctl registration for nlm_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.

Signed-off-by: Luis Chamberlain <[email protected]>
---
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


2023-03-13 10:49:56

by Jeff Layton

[permalink] [raw]
Subject: Re: nfs/lockd: simplify sysctl registration

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/[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(-)
>

Reviewed-by: Jeff Layton <[email protected]>