[PATCH 3/5] quota: simplify two-level sysctl registration for fs_dqstats_table

Luis Chamberlain posted 5 patches 2 years, 11 months ago
[PATCH 3/5] quota: simplify two-level sysctl registration for fs_dqstats_table
Posted by Luis Chamberlain 2 years, 11 months ago
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
Re: [PATCH 3/5] quota: simplify two-level sysctl registration for fs_dqstats_table
Posted by Jan Kara 2 years, 11 months ago
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