linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] f2fs: remove bulk remove_proc_entry() and unnecessary kobject_del()
@ 2023-04-06 19:16 Yangtao Li via Linux-f2fs-devel
  2023-04-13 15:18 ` Chao Yu
  2023-04-17 21:50 ` patchwork-bot+f2fs
  0 siblings, 2 replies; 5+ messages in thread
From: Yangtao Li via Linux-f2fs-devel @ 2023-04-06 19:16 UTC (permalink / raw)
  To: Jaegeuk Kim, Chao Yu; +Cc: linux-f2fs-devel, linux-kernel, Yangtao Li

Convert to use remove_proc_subtree() and kill kobject_del() directly.
kobject_put() actually covers kobject removal automatically, which is
single stage removal.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 fs/f2fs/sysfs.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
index dfbd17802549..3aad3500a701 100644
--- a/fs/f2fs/sysfs.c
+++ b/fs/f2fs/sysfs.c
@@ -1461,25 +1461,14 @@ int f2fs_register_sysfs(struct f2fs_sb_info *sbi)
 
 void f2fs_unregister_sysfs(struct f2fs_sb_info *sbi)
 {
-	if (sbi->s_proc) {
-#ifdef CONFIG_F2FS_IOSTAT
-		remove_proc_entry("iostat_info", sbi->s_proc);
-#endif
-		remove_proc_entry("segment_info", sbi->s_proc);
-		remove_proc_entry("segment_bits", sbi->s_proc);
-		remove_proc_entry("victim_bits", sbi->s_proc);
-		remove_proc_entry("discard_plist_info", sbi->s_proc);
-		remove_proc_entry(sbi->sb->s_id, f2fs_proc_root);
-	}
+	if (sbi->s_proc)
+		remove_proc_subtree(sbi->sb->s_id, f2fs_proc_root);
 
-	kobject_del(&sbi->s_stat_kobj);
 	kobject_put(&sbi->s_stat_kobj);
 	wait_for_completion(&sbi->s_stat_kobj_unregister);
-	kobject_del(&sbi->s_feature_list_kobj);
 	kobject_put(&sbi->s_feature_list_kobj);
 	wait_for_completion(&sbi->s_feature_list_kobj_unregister);
 
-	kobject_del(&sbi->s_kobj);
 	kobject_put(&sbi->s_kobj);
 	wait_for_completion(&sbi->s_kobj_unregister);
 }
-- 
2.35.1



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH] f2fs: remove bulk remove_proc_entry() and unnecessary kobject_del()
  2023-04-06 19:16 [f2fs-dev] [PATCH] f2fs: remove bulk remove_proc_entry() and unnecessary kobject_del() Yangtao Li via Linux-f2fs-devel
@ 2023-04-13 15:18 ` Chao Yu
  2023-04-13 15:54   ` Jaegeuk Kim
  2023-04-17 21:50 ` patchwork-bot+f2fs
  1 sibling, 1 reply; 5+ messages in thread
From: Chao Yu @ 2023-04-13 15:18 UTC (permalink / raw)
  To: Yangtao Li, Jaegeuk Kim; +Cc: linux-kernel, linux-f2fs-devel

On 2023/4/7 3:16, Yangtao Li wrote:
> Convert to use remove_proc_subtree() and kill kobject_del() directly.
> kobject_put() actually covers kobject removal automatically, which is
> single stage removal.
> 
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
>   fs/f2fs/sysfs.c | 15 ++-------------
>   1 file changed, 2 insertions(+), 13 deletions(-)
> 
> diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> index dfbd17802549..3aad3500a701 100644
> --- a/fs/f2fs/sysfs.c
> +++ b/fs/f2fs/sysfs.c
> @@ -1461,25 +1461,14 @@ int f2fs_register_sysfs(struct f2fs_sb_info *sbi)
>   
>   void f2fs_unregister_sysfs(struct f2fs_sb_info *sbi)
>   {
> -	if (sbi->s_proc) {
> -#ifdef CONFIG_F2FS_IOSTAT
> -		remove_proc_entry("iostat_info", sbi->s_proc);
> -#endif
> -		remove_proc_entry("segment_info", sbi->s_proc);
> -		remove_proc_entry("segment_bits", sbi->s_proc);
> -		remove_proc_entry("victim_bits", sbi->s_proc);
> -		remove_proc_entry("discard_plist_info", sbi->s_proc);
> -		remove_proc_entry(sbi->sb->s_id, f2fs_proc_root);
> -	}
> +	if (sbi->s_proc)
> +		remove_proc_subtree(sbi->sb->s_id, f2fs_proc_root);
>   
> -	kobject_del(&sbi->s_stat_kobj);

- f2fs_register_sysfs
  - kobject_init_and_add(&sbi->s_stat_kobj, ..)

/**
  * kobject_init_and_add() - Initialize a kobject structure and add it to
  *                          the kobject hierarchy.
...
  *
  * This function combines the call to kobject_init() and kobject_add().
...
  */

/**
  * kobject_del() - Unlink kobject from hierarchy.
  * @kobj: object.
  *
  * This is the function that should be called to delete an object
  * successfully added via kobject_add().
  */

Am I missing something?

Thanks,

>   	kobject_put(&sbi->s_stat_kobj);
>   	wait_for_completion(&sbi->s_stat_kobj_unregister);
> -	kobject_del(&sbi->s_feature_list_kobj);
>   	kobject_put(&sbi->s_feature_list_kobj);
>   	wait_for_completion(&sbi->s_feature_list_kobj_unregister);
>   
> -	kobject_del(&sbi->s_kobj);
>   	kobject_put(&sbi->s_kobj);
>   	wait_for_completion(&sbi->s_kobj_unregister);
>   }


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH] f2fs: remove bulk remove_proc_entry() and unnecessary kobject_del()
  2023-04-13 15:18 ` Chao Yu
@ 2023-04-13 15:54   ` Jaegeuk Kim
  2023-04-16 15:02     ` Chao Yu
  0 siblings, 1 reply; 5+ messages in thread
From: Jaegeuk Kim @ 2023-04-13 15:54 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-f2fs-devel, linux-kernel, Yangtao Li

On 04/13, Chao Yu wrote:
> On 2023/4/7 3:16, Yangtao Li wrote:
> > Convert to use remove_proc_subtree() and kill kobject_del() directly.
> > kobject_put() actually covers kobject removal automatically, which is
> > single stage removal.
> > 
> > Signed-off-by: Yangtao Li <frank.li@vivo.com>
> > ---
> >   fs/f2fs/sysfs.c | 15 ++-------------
> >   1 file changed, 2 insertions(+), 13 deletions(-)
> > 
> > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> > index dfbd17802549..3aad3500a701 100644
> > --- a/fs/f2fs/sysfs.c
> > +++ b/fs/f2fs/sysfs.c
> > @@ -1461,25 +1461,14 @@ int f2fs_register_sysfs(struct f2fs_sb_info *sbi)
> >   void f2fs_unregister_sysfs(struct f2fs_sb_info *sbi)
> >   {
> > -	if (sbi->s_proc) {
> > -#ifdef CONFIG_F2FS_IOSTAT
> > -		remove_proc_entry("iostat_info", sbi->s_proc);
> > -#endif
> > -		remove_proc_entry("segment_info", sbi->s_proc);
> > -		remove_proc_entry("segment_bits", sbi->s_proc);
> > -		remove_proc_entry("victim_bits", sbi->s_proc);
> > -		remove_proc_entry("discard_plist_info", sbi->s_proc);
> > -		remove_proc_entry(sbi->sb->s_id, f2fs_proc_root);
> > -	}
> > +	if (sbi->s_proc)
> > +		remove_proc_subtree(sbi->sb->s_id, f2fs_proc_root);
> > -	kobject_del(&sbi->s_stat_kobj);
> 
> - f2fs_register_sysfs
>  - kobject_init_and_add(&sbi->s_stat_kobj, ..)
> 
> /**
>  * kobject_init_and_add() - Initialize a kobject structure and add it to
>  *                          the kobject hierarchy.
> ...
>  *
>  * This function combines the call to kobject_init() and kobject_add().
> ...
>  */
> 
> /**
>  * kobject_del() - Unlink kobject from hierarchy.
>  * @kobj: object.
>  *
>  * This is the function that should be called to delete an object
>  * successfully added via kobject_add().
>  */
> 
> Am I missing something?

kobject_put -> kobject_cleanup was supposed to do it?

> 
> Thanks,
> 
> >   	kobject_put(&sbi->s_stat_kobj);
> >   	wait_for_completion(&sbi->s_stat_kobj_unregister);
> > -	kobject_del(&sbi->s_feature_list_kobj);
> >   	kobject_put(&sbi->s_feature_list_kobj);
> >   	wait_for_completion(&sbi->s_feature_list_kobj_unregister);
> > -	kobject_del(&sbi->s_kobj);
> >   	kobject_put(&sbi->s_kobj);
> >   	wait_for_completion(&sbi->s_kobj_unregister);
> >   }


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH] f2fs: remove bulk remove_proc_entry() and unnecessary kobject_del()
  2023-04-13 15:54   ` Jaegeuk Kim
@ 2023-04-16 15:02     ` Chao Yu
  0 siblings, 0 replies; 5+ messages in thread
From: Chao Yu @ 2023-04-16 15:02 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: linux-f2fs-devel, linux-kernel, Yangtao Li

On 2023/4/13 23:54, Jaegeuk Kim wrote:
> On 04/13, Chao Yu wrote:
>> On 2023/4/7 3:16, Yangtao Li wrote:
>>> Convert to use remove_proc_subtree() and kill kobject_del() directly.
>>> kobject_put() actually covers kobject removal automatically, which is
>>> single stage removal.
>>>
>>> Signed-off-by: Yangtao Li <frank.li@vivo.com>
>>> ---
>>>    fs/f2fs/sysfs.c | 15 ++-------------
>>>    1 file changed, 2 insertions(+), 13 deletions(-)
>>>
>>> diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
>>> index dfbd17802549..3aad3500a701 100644
>>> --- a/fs/f2fs/sysfs.c
>>> +++ b/fs/f2fs/sysfs.c
>>> @@ -1461,25 +1461,14 @@ int f2fs_register_sysfs(struct f2fs_sb_info *sbi)
>>>    void f2fs_unregister_sysfs(struct f2fs_sb_info *sbi)
>>>    {
>>> -	if (sbi->s_proc) {
>>> -#ifdef CONFIG_F2FS_IOSTAT
>>> -		remove_proc_entry("iostat_info", sbi->s_proc);
>>> -#endif
>>> -		remove_proc_entry("segment_info", sbi->s_proc);
>>> -		remove_proc_entry("segment_bits", sbi->s_proc);
>>> -		remove_proc_entry("victim_bits", sbi->s_proc);
>>> -		remove_proc_entry("discard_plist_info", sbi->s_proc);
>>> -		remove_proc_entry(sbi->sb->s_id, f2fs_proc_root);
>>> -	}
>>> +	if (sbi->s_proc)
>>> +		remove_proc_subtree(sbi->sb->s_id, f2fs_proc_root);
>>> -	kobject_del(&sbi->s_stat_kobj);
>>
>> - f2fs_register_sysfs
>>   - kobject_init_and_add(&sbi->s_stat_kobj, ..)
>>
>> /**
>>   * kobject_init_and_add() - Initialize a kobject structure and add it to
>>   *                          the kobject hierarchy.
>> ...
>>   *
>>   * This function combines the call to kobject_init() and kobject_add().
>> ...
>>   */
>>
>> /**
>>   * kobject_del() - Unlink kobject from hierarchy.
>>   * @kobj: object.
>>   *
>>   * This is the function that should be called to delete an object
>>   * successfully added via kobject_add().
>>   */
>>
>> Am I missing something?
> 
> kobject_put -> kobject_cleanup was supposed to do it?

Yes, it seems so.

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,

> 
>>
>> Thanks,
>>
>>>    	kobject_put(&sbi->s_stat_kobj);
>>>    	wait_for_completion(&sbi->s_stat_kobj_unregister);
>>> -	kobject_del(&sbi->s_feature_list_kobj);
>>>    	kobject_put(&sbi->s_feature_list_kobj);
>>>    	wait_for_completion(&sbi->s_feature_list_kobj_unregister);
>>> -	kobject_del(&sbi->s_kobj);
>>>    	kobject_put(&sbi->s_kobj);
>>>    	wait_for_completion(&sbi->s_kobj_unregister);
>>>    }


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH] f2fs: remove bulk remove_proc_entry() and unnecessary kobject_del()
  2023-04-06 19:16 [f2fs-dev] [PATCH] f2fs: remove bulk remove_proc_entry() and unnecessary kobject_del() Yangtao Li via Linux-f2fs-devel
  2023-04-13 15:18 ` Chao Yu
@ 2023-04-17 21:50 ` patchwork-bot+f2fs
  1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+f2fs @ 2023-04-17 21:50 UTC (permalink / raw)
  To: Yangtao Li; +Cc: jaegeuk, linux-kernel, linux-f2fs-devel

Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:

On Fri,  7 Apr 2023 03:16:29 +0800 you wrote:
> Convert to use remove_proc_subtree() and kill kobject_del() directly.
> kobject_put() actually covers kobject removal automatically, which is
> single stage removal.
> 
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
>  fs/f2fs/sysfs.c | 15 ++-------------
>  1 file changed, 2 insertions(+), 13 deletions(-)

Here is the summary with links:
  - [f2fs-dev] f2fs: remove bulk remove_proc_entry() and unnecessary kobject_del()
    https://git.kernel.org/jaegeuk/f2fs/c/33560f8020c2

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

end of thread, other threads:[~2023-04-17 21:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-06 19:16 [f2fs-dev] [PATCH] f2fs: remove bulk remove_proc_entry() and unnecessary kobject_del() Yangtao Li via Linux-f2fs-devel
2023-04-13 15:18 ` Chao Yu
2023-04-13 15:54   ` Jaegeuk Kim
2023-04-16 15:02     ` Chao Yu
2023-04-17 21:50 ` patchwork-bot+f2fs

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