* [PATCH 0/5] misc filesystems: simplify sysctl registration
@ 2023-03-10 23:12 Luis Chamberlain
2023-03-10 23:12 ` [PATCH 1/5] fs/cachefiles: simplify one-level sysctl registration for cachefiles_sysctls Luis Chamberlain
` (4 more replies)
0 siblings, 5 replies; 9+ messages in thread
From: Luis Chamberlain @ 2023-03-10 23:12 UTC (permalink / raw)
To: dhowells, linux-cachefs, jack, jaharkes, coda, codalist, anton,
linux-ntfs-dev
Cc: ebiederm, keescook, yzaikin, j.granados, patches, linux-fsdevel,
linux-kernel, Luis Chamberlain
This simplifies syctl registration for a few misc filesystems according
to our latest preference / guidance [0]. register_sysctl_table() incurs
possible recursion and we can avoid that by dealing with flat
directories with files in them, and having the subdirectories explicitly
named with register_sysctl().
As we phase these callers out we can deprecate / remove register_sysctl_table()
eventually.
If you're a maintainer feel free to pick up the patch or I'm also happy
to take it through sysctl-next if you like. These don't create
conflicts so there is no requirement they go throug sysclt-next at all.
I can pick up stragglers later.
[0] https://lore.kernel.org/all/20230310223947.3917711-1-mcgrof@kernel.org/T/#u
Luis Chamberlain (5):
fs/cachefiles: simplify one-level sysctl registration for
cachefiles_sysctls
devpts: simplify two-level sysctl registration for pty_kern_table
quota: simplify two-level sysctl registration for fs_dqstats_table
coda: simplify one-level sysctl registration for coda_table
ntfs: simplfy one-level sysctl registration for ntfs_sysctls
fs/cachefiles/error_inject.c | 11 +----------
fs/coda/sysctl.c | 11 +----------
fs/devpts/inode.c | 20 +-------------------
fs/ntfs/sysctl.c | 12 +-----------
fs/quota/dquot.c | 20 +-------------------
5 files changed, 5 insertions(+), 69 deletions(-)
--
2.39.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/5] fs/cachefiles: simplify one-level sysctl registration for cachefiles_sysctls
2023-03-10 23:12 [PATCH 0/5] misc filesystems: simplify sysctl registration Luis Chamberlain
@ 2023-03-10 23:12 ` Luis Chamberlain
2023-03-10 23:12 ` [PATCH 2/5] devpts: simplify two-level sysctl registration for pty_kern_table Luis Chamberlain
` (3 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Luis Chamberlain @ 2023-03-10 23:12 UTC (permalink / raw)
To: dhowells, linux-cachefs, jack, jaharkes, coda, codalist, anton,
linux-ntfs-dev
Cc: ebiederm, keescook, yzaikin, j.granados, patches, linux-fsdevel,
linux-kernel, Luis Chamberlain
There 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.
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
fs/cachefiles/error_inject.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/fs/cachefiles/error_inject.c b/fs/cachefiles/error_inject.c
index 58f8aec964e4..18de8a876b02 100644
--- a/fs/cachefiles/error_inject.c
+++ b/fs/cachefiles/error_inject.c
@@ -22,18 +22,9 @@ static struct ctl_table cachefiles_sysctls[] = {
{}
};
-static struct ctl_table cachefiles_sysctls_root[] = {
- {
- .procname = "cachefiles",
- .mode = 0555,
- .child = cachefiles_sysctls,
- },
- {}
-};
-
int __init cachefiles_register_error_injection(void)
{
- cachefiles_sysctl = register_sysctl_table(cachefiles_sysctls_root);
+ cachefiles_sysctl = register_sysctl("cachefiles", cachefiles_sysctls);
if (!cachefiles_sysctl)
return -ENOMEM;
return 0;
--
2.39.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/5] devpts: simplify two-level sysctl registration for pty_kern_table
2023-03-10 23:12 [PATCH 0/5] misc filesystems: simplify sysctl registration Luis Chamberlain
2023-03-10 23:12 ` [PATCH 1/5] fs/cachefiles: simplify one-level sysctl registration for cachefiles_sysctls Luis Chamberlain
@ 2023-03-10 23:12 ` Luis Chamberlain
2023-03-13 11:38 ` Christian Brauner
2023-03-10 23:12 ` [PATCH 3/5] quota: simplify two-level sysctl registration for fs_dqstats_table Luis Chamberlain
` (2 subsequent siblings)
4 siblings, 1 reply; 9+ messages in thread
From: Luis Chamberlain @ 2023-03-10 23:12 UTC (permalink / raw)
To: dhowells, linux-cachefs, jack, jaharkes, coda, codalist, anton,
linux-ntfs-dev
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/devpts/inode.c | 20 +-------------------
1 file changed, 1 insertion(+), 19 deletions(-)
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index 4f25015aa534..fe3db0eda8e4 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -72,24 +72,6 @@ static struct ctl_table pty_table[] = {
{}
};
-static struct ctl_table pty_kern_table[] = {
- {
- .procname = "pty",
- .mode = 0555,
- .child = pty_table,
- },
- {}
-};
-
-static struct ctl_table pty_root_table[] = {
- {
- .procname = "kernel",
- .mode = 0555,
- .child = pty_kern_table,
- },
- {}
-};
-
struct pts_mount_opts {
int setuid;
int setgid;
@@ -630,7 +612,7 @@ static int __init init_devpts_fs(void)
{
int err = register_filesystem(&devpts_fs_type);
if (!err) {
- register_sysctl_table(pty_root_table);
+ register_sysctl("kernel/pty", pty_table);
}
return err;
}
--
2.39.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/5] quota: simplify two-level sysctl registration for fs_dqstats_table
2023-03-10 23:12 [PATCH 0/5] misc filesystems: simplify sysctl registration Luis Chamberlain
2023-03-10 23:12 ` [PATCH 1/5] fs/cachefiles: simplify one-level sysctl registration for cachefiles_sysctls Luis Chamberlain
2023-03-10 23:12 ` [PATCH 2/5] devpts: simplify two-level sysctl registration for pty_kern_table Luis Chamberlain
@ 2023-03-10 23:12 ` Luis Chamberlain
2023-03-13 10:32 ` Jan Kara
2023-03-10 23:12 ` [PATCH 4/5] coda: simplify one-level sysctl registration for coda_table Luis Chamberlain
2023-03-10 23:12 ` [PATCH 5/5] ntfs: simplfy one-level sysctl registration for ntfs_sysctls Luis Chamberlain
4 siblings, 1 reply; 9+ messages in thread
From: Luis Chamberlain @ 2023-03-10 23:12 UTC (permalink / raw)
To: dhowells, linux-cachefs, jack, jaharkes, coda, codalist, anton,
linux-ntfs-dev
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/quota/dquot.c | 20 +-------------------
1 file changed, 1 insertion(+), 19 deletions(-)
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index a6357f728034..90cb70c82012 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -2948,24 +2948,6 @@ static struct ctl_table fs_dqstats_table[] = {
{ },
};
-static struct ctl_table fs_table[] = {
- {
- .procname = "quota",
- .mode = 0555,
- .child = fs_dqstats_table,
- },
- { },
-};
-
-static struct ctl_table sys_table[] = {
- {
- .procname = "fs",
- .mode = 0555,
- .child = fs_table,
- },
- { },
-};
-
static int __init dquot_init(void)
{
int i, ret;
@@ -2973,7 +2955,7 @@ static int __init dquot_init(void)
printk(KERN_NOTICE "VFS: Disk quotas %s\n", __DQUOT_VERSION__);
- register_sysctl_table(sys_table);
+ register_sysctl("fs/quota", fs_dqstats_table);
dquot_cachep = kmem_cache_create("dquot",
sizeof(struct dquot), sizeof(unsigned long) * 4,
--
2.39.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/5] coda: simplify one-level sysctl registration for coda_table
2023-03-10 23:12 [PATCH 0/5] misc filesystems: simplify sysctl registration Luis Chamberlain
` (2 preceding siblings ...)
2023-03-10 23:12 ` [PATCH 3/5] quota: simplify two-level sysctl registration for fs_dqstats_table Luis Chamberlain
@ 2023-03-10 23:12 ` Luis Chamberlain
2023-03-13 13:21 ` Jan Harkes
2023-03-10 23:12 ` [PATCH 5/5] ntfs: simplfy one-level sysctl registration for ntfs_sysctls Luis Chamberlain
4 siblings, 1 reply; 9+ messages in thread
From: Luis Chamberlain @ 2023-03-10 23:12 UTC (permalink / raw)
To: dhowells, linux-cachefs, jack, jaharkes, coda, codalist, anton,
linux-ntfs-dev
Cc: ebiederm, keescook, yzaikin, j.granados, patches, linux-fsdevel,
linux-kernel, Luis Chamberlain
There 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.
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
fs/coda/sysctl.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/fs/coda/sysctl.c b/fs/coda/sysctl.c
index fda3b702b1c5..a247c14aaab7 100644
--- a/fs/coda/sysctl.c
+++ b/fs/coda/sysctl.c
@@ -39,19 +39,10 @@ static struct ctl_table coda_table[] = {
{}
};
-static struct ctl_table fs_table[] = {
- {
- .procname = "coda",
- .mode = 0555,
- .child = coda_table
- },
- {}
-};
-
void coda_sysctl_init(void)
{
if ( !fs_table_header )
- fs_table_header = register_sysctl_table(fs_table);
+ fs_table_header = register_sysctl("coda", coda_table);
}
void coda_sysctl_clean(void)
--
2.39.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 5/5] ntfs: simplfy one-level sysctl registration for ntfs_sysctls
2023-03-10 23:12 [PATCH 0/5] misc filesystems: simplify sysctl registration Luis Chamberlain
` (3 preceding siblings ...)
2023-03-10 23:12 ` [PATCH 4/5] coda: simplify one-level sysctl registration for coda_table Luis Chamberlain
@ 2023-03-10 23:12 ` Luis Chamberlain
4 siblings, 0 replies; 9+ messages in thread
From: Luis Chamberlain @ 2023-03-10 23:12 UTC (permalink / raw)
To: dhowells, linux-cachefs, jack, jaharkes, coda, codalist, anton,
linux-ntfs-dev
Cc: ebiederm, keescook, yzaikin, j.granados, patches, linux-fsdevel,
linux-kernel, Luis Chamberlain
There 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.
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
fs/ntfs/sysctl.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/fs/ntfs/sysctl.c b/fs/ntfs/sysctl.c
index a030d00af90c..174fe536a1c0 100644
--- a/fs/ntfs/sysctl.c
+++ b/fs/ntfs/sysctl.c
@@ -31,16 +31,6 @@ static struct ctl_table ntfs_sysctls[] = {
{}
};
-/* Define the parent directory /proc/sys/fs. */
-static struct ctl_table sysctls_root[] = {
- {
- .procname = "fs",
- .mode = 0555,
- .child = ntfs_sysctls
- },
- {}
-};
-
/* Storage for the sysctls header. */
static struct ctl_table_header *sysctls_root_table;
@@ -54,7 +44,7 @@ int ntfs_sysctl(int add)
{
if (add) {
BUG_ON(sysctls_root_table);
- sysctls_root_table = register_sysctl_table(sysctls_root);
+ sysctls_root_table = register_sysctl("fs", ntfs_sysctls);
if (!sysctls_root_table)
return -ENOMEM;
} else {
--
2.39.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 3/5] quota: simplify two-level sysctl registration for fs_dqstats_table
2023-03-10 23:12 ` [PATCH 3/5] quota: simplify two-level sysctl registration for fs_dqstats_table Luis Chamberlain
@ 2023-03-13 10:32 ` Jan Kara
0 siblings, 0 replies; 9+ messages in thread
From: Jan Kara @ 2023-03-13 10:32 UTC (permalink / raw)
To: Luis Chamberlain
Cc: dhowells, linux-cachefs, jack, jaharkes, coda, codalist, anton,
linux-ntfs-dev, ebiederm, keescook, yzaikin, j.granados, patches,
linux-fsdevel, linux-kernel
On Fri 10-03-23 15:12:04, Luis Chamberlain 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>
Thanks. I've taken the patch into my tree.
Honza
> ---
> fs/quota/dquot.c | 20 +-------------------
> 1 file changed, 1 insertion(+), 19 deletions(-)
>
> diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
> index a6357f728034..90cb70c82012 100644
> --- a/fs/quota/dquot.c
> +++ b/fs/quota/dquot.c
> @@ -2948,24 +2948,6 @@ static struct ctl_table fs_dqstats_table[] = {
> { },
> };
>
> -static struct ctl_table fs_table[] = {
> - {
> - .procname = "quota",
> - .mode = 0555,
> - .child = fs_dqstats_table,
> - },
> - { },
> -};
> -
> -static struct ctl_table sys_table[] = {
> - {
> - .procname = "fs",
> - .mode = 0555,
> - .child = fs_table,
> - },
> - { },
> -};
> -
> static int __init dquot_init(void)
> {
> int i, ret;
> @@ -2973,7 +2955,7 @@ static int __init dquot_init(void)
>
> printk(KERN_NOTICE "VFS: Disk quotas %s\n", __DQUOT_VERSION__);
>
> - register_sysctl_table(sys_table);
> + register_sysctl("fs/quota", fs_dqstats_table);
>
> dquot_cachep = kmem_cache_create("dquot",
> sizeof(struct dquot), sizeof(unsigned long) * 4,
> --
> 2.39.1
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/5] devpts: simplify two-level sysctl registration for pty_kern_table
2023-03-10 23:12 ` [PATCH 2/5] devpts: simplify two-level sysctl registration for pty_kern_table Luis Chamberlain
@ 2023-03-13 11:38 ` Christian Brauner
0 siblings, 0 replies; 9+ messages in thread
From: Christian Brauner @ 2023-03-13 11:38 UTC (permalink / raw)
To: Luis Chamberlain
Cc: dhowells, linux-cachefs, jack, jaharkes, coda, codalist, anton,
linux-ntfs-dev, ebiederm, keescook, yzaikin, j.granados, patches,
linux-fsdevel, linux-kernel
On Fri, Mar 10, 2023 at 03:12:03PM -0800, Luis Chamberlain 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, Luis. Thanks!
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 4/5] coda: simplify one-level sysctl registration for coda_table
2023-03-10 23:12 ` [PATCH 4/5] coda: simplify one-level sysctl registration for coda_table Luis Chamberlain
@ 2023-03-13 13:21 ` Jan Harkes
0 siblings, 0 replies; 9+ messages in thread
From: Jan Harkes @ 2023-03-13 13:21 UTC (permalink / raw)
To: Luis Chamberlain
Cc: dhowells, linux-cachefs, jack, anton, linux-ntfs-dev, ebiederm,
keescook, yzaikin, j.granados, patches, linux-fsdevel,
linux-kernel
Looks good to me, nice little cleanup.
Jan
On Fri, Mar 10, 2023 at 07:04:07PM -0500, Luis Chamberlain wrote:
> There 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.
>
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Acked-by: Jan Harkes <jaharkes@cs.cmu.edu
> ---
> fs/coda/sysctl.c | 11 +----------
> 1 file changed, 1 insertion(+), 10 deletions(-)
>
> diff --git a/fs/coda/sysctl.c b/fs/coda/sysctl.c
> index fda3b702b1c5..a247c14aaab7 100644
> --- a/fs/coda/sysctl.c
> +++ b/fs/coda/sysctl.c
> @@ -39,19 +39,10 @@ static struct ctl_table coda_table[] = {
> {}
> };
>
> -static struct ctl_table fs_table[] = {
> - {
> - .procname = "coda",
> - .mode = 0555,
> - .child = coda_table
> - },
> - {}
> -};
> -
> void coda_sysctl_init(void)
> {
> if ( !fs_table_header )
> - fs_table_header = register_sysctl_table(fs_table);
> + fs_table_header = register_sysctl("coda", coda_table);
> }
>
> void coda_sysctl_clean(void)
> --
> 2.39.1
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-03-13 13:21 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-10 23:12 [PATCH 0/5] misc filesystems: simplify sysctl registration Luis Chamberlain
2023-03-10 23:12 ` [PATCH 1/5] fs/cachefiles: simplify one-level sysctl registration for cachefiles_sysctls Luis Chamberlain
2023-03-10 23:12 ` [PATCH 2/5] devpts: simplify two-level sysctl registration for pty_kern_table Luis Chamberlain
2023-03-13 11:38 ` Christian Brauner
2023-03-10 23:12 ` [PATCH 3/5] quota: simplify two-level sysctl registration for fs_dqstats_table Luis Chamberlain
2023-03-13 10:32 ` Jan Kara
2023-03-10 23:12 ` [PATCH 4/5] coda: simplify one-level sysctl registration for coda_table Luis Chamberlain
2023-03-13 13:21 ` Jan Harkes
2023-03-10 23:12 ` [PATCH 5/5] ntfs: simplfy one-level sysctl registration for ntfs_sysctls Luis Chamberlain
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).