linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2, RESEND 01/10] kobject: introduce kobject_del_and_put()
@ 2023-03-19  9:26 Yangtao Li
  2023-03-19  9:26 ` [PATCH v2, RESEND 02/10] f2fs: convert to kobject_del_and_put() Yangtao Li
                   ` (8 more replies)
  0 siblings, 9 replies; 19+ messages in thread
From: Yangtao Li @ 2023-03-19  9:26 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Yangtao Li, linux-kernel

There are plenty of using kobject_del() and kobject_put() together
in the kernel tree. This patch wraps these two calls in a single helper.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
v2:
-add kobject_del_and_put() users
resend patchset to gregkh and Rafael
 include/linux/kobject.h |  1 +
 lib/kobject.c           | 17 +++++++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index bdab370a24f4..782d4bd119f8 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -111,6 +111,7 @@ extern struct kobject *kobject_get(struct kobject *kobj);
 extern struct kobject * __must_check kobject_get_unless_zero(
 						struct kobject *kobj);
 extern void kobject_put(struct kobject *kobj);
+extern void kobject_del_and_put(struct kobject *kobj);
 
 extern const void *kobject_namespace(const struct kobject *kobj);
 extern void kobject_get_ownership(const struct kobject *kobj,
diff --git a/lib/kobject.c b/lib/kobject.c
index 6e2f0bee3560..8c0293e37214 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -731,6 +731,20 @@ void kobject_put(struct kobject *kobj)
 }
 EXPORT_SYMBOL(kobject_put);
 
+/**
+ * kobject_del_and_put() - Delete kobject.
+ * @kobj: object.
+ *
+ * Unlink kobject from hierarchy and decrement the refcount.
+ * If refcount is 0, call kobject_cleanup().
+ */
+void kobject_del_and_put(struct kobject *kobj)
+{
+	kobject_del(kobj);
+	kobject_put(kobj);
+}
+EXPORT_SYMBOL_GPL(kobject_del_and_put);
+
 static void dynamic_kobj_release(struct kobject *kobj)
 {
 	pr_debug("kobject: (%p): %s\n", kobj, __func__);
@@ -874,8 +888,7 @@ void kset_unregister(struct kset *k)
 {
 	if (!k)
 		return;
-	kobject_del(&k->kobj);
-	kobject_put(&k->kobj);
+	kobject_del_and_put(&k->kobj);
 }
 EXPORT_SYMBOL(kset_unregister);
 
-- 
2.35.1


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

* [PATCH v2, RESEND 02/10] f2fs: convert to kobject_del_and_put()
  2023-03-19  9:26 [PATCH v2, RESEND 01/10] kobject: introduce kobject_del_and_put() Yangtao Li
@ 2023-03-19  9:26 ` Yangtao Li
  2023-03-19  9:26 ` [PATCH v2, RESEND 03/10] erofs: " Yangtao Li
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 19+ messages in thread
From: Yangtao Li @ 2023-03-19  9:26 UTC (permalink / raw)
  To: Jaegeuk Kim, Chao Yu
  Cc: Yangtao Li, Greg Kroah-Hartman, Rafael J. Wysocki,
	linux-f2fs-devel, linux-kernel

Use kobject_del_and_put() to simplify code.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 fs/f2fs/sysfs.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
index 9ddc6ee19433..b455afc12cfc 100644
--- a/fs/f2fs/sysfs.c
+++ b/fs/f2fs/sysfs.c
@@ -1478,14 +1478,11 @@ void f2fs_unregister_sysfs(struct f2fs_sb_info *sbi)
 		remove_proc_entry(sbi->sb->s_id, f2fs_proc_root);
 	}
 
-	kobject_del(&sbi->s_stat_kobj);
-	kobject_put(&sbi->s_stat_kobj);
+	kobject_del_and_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);
+	kobject_del_and_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);
+	kobject_del_and_put(&sbi->s_kobj);
 	wait_for_completion(&sbi->s_kobj_unregister);
 }
-- 
2.35.1


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

* [PATCH v2, RESEND 03/10] erofs: convert to kobject_del_and_put()
  2023-03-19  9:26 [PATCH v2, RESEND 01/10] kobject: introduce kobject_del_and_put() Yangtao Li
  2023-03-19  9:26 ` [PATCH v2, RESEND 02/10] f2fs: convert to kobject_del_and_put() Yangtao Li
@ 2023-03-19  9:26 ` Yangtao Li
  2023-03-19  9:26 ` [PATCH v2, RESEND 04/10] zonefs: " Yangtao Li
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 19+ messages in thread
From: Yangtao Li @ 2023-03-19  9:26 UTC (permalink / raw)
  To: Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu
  Cc: Yangtao Li, Greg Kroah-Hartman, Rafael J. Wysocki, linux-erofs,
	linux-kernel

Use kobject_del_and_put() to simplify code.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 fs/erofs/sysfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/erofs/sysfs.c b/fs/erofs/sysfs.c
index 435e515c0792..9ed7d6552155 100644
--- a/fs/erofs/sysfs.c
+++ b/fs/erofs/sysfs.c
@@ -241,8 +241,7 @@ void erofs_unregister_sysfs(struct super_block *sb)
 	struct erofs_sb_info *sbi = EROFS_SB(sb);
 
 	if (sbi->s_kobj.state_in_sysfs) {
-		kobject_del(&sbi->s_kobj);
-		kobject_put(&sbi->s_kobj);
+		kobject_del_and_put(&sbi->s_kobj);
 		wait_for_completion(&sbi->s_kobj_unregister);
 	}
 }
-- 
2.35.1


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

* [PATCH v2, RESEND 04/10] zonefs: convert to kobject_del_and_put()
  2023-03-19  9:26 [PATCH v2, RESEND 01/10] kobject: introduce kobject_del_and_put() Yangtao Li
  2023-03-19  9:26 ` [PATCH v2, RESEND 02/10] f2fs: convert to kobject_del_and_put() Yangtao Li
  2023-03-19  9:26 ` [PATCH v2, RESEND 03/10] erofs: " Yangtao Li
@ 2023-03-19  9:26 ` Yangtao Li
  2023-03-19 21:42   ` Damien Le Moal
  2023-03-19  9:26 ` [PATCH v2, RESEND 05/10] ubifs: " Yangtao Li
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Yangtao Li @ 2023-03-19  9:26 UTC (permalink / raw)
  To: Damien Le Moal, Naohiro Aota, Johannes Thumshirn
  Cc: Yangtao Li, Greg Kroah-Hartman, Rafael J. Wysocki, linux-fsdevel,
	linux-kernel

Use kobject_del_and_put() to simplify code.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 fs/zonefs/sysfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/zonefs/sysfs.c b/fs/zonefs/sysfs.c
index 8ccb65c2b419..5e117188fbb5 100644
--- a/fs/zonefs/sysfs.c
+++ b/fs/zonefs/sysfs.c
@@ -113,8 +113,7 @@ void zonefs_sysfs_unregister(struct super_block *sb)
 	if (!sbi || !sbi->s_sysfs_registered)
 		return;
 
-	kobject_del(&sbi->s_kobj);
-	kobject_put(&sbi->s_kobj);
+	kobject_del_and_put(&sbi->s_kobj);
 	wait_for_completion(&sbi->s_kobj_unregister);
 }
 
-- 
2.35.1


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

* [PATCH v2, RESEND 05/10] ubifs: convert to kobject_del_and_put()
  2023-03-19  9:26 [PATCH v2, RESEND 01/10] kobject: introduce kobject_del_and_put() Yangtao Li
                   ` (2 preceding siblings ...)
  2023-03-19  9:26 ` [PATCH v2, RESEND 04/10] zonefs: " Yangtao Li
@ 2023-03-19  9:26 ` Yangtao Li
  2023-03-20  2:55   ` Zhihao Cheng
  2023-03-19  9:26 ` [PATCH v2, RESEND 06/10] btrfs: " Yangtao Li
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Yangtao Li @ 2023-03-19  9:26 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Yangtao Li, Greg Kroah-Hartman, Rafael J. Wysocki, linux-mtd,
	linux-kernel

Use kobject_del_and_put() to simplify code.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 fs/ubifs/sysfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/ubifs/sysfs.c b/fs/ubifs/sysfs.c
index 1c958148bb87..9571718e61a9 100644
--- a/fs/ubifs/sysfs.c
+++ b/fs/ubifs/sysfs.c
@@ -130,8 +130,7 @@ int ubifs_sysfs_register(struct ubifs_info *c)
 
 void ubifs_sysfs_unregister(struct ubifs_info *c)
 {
-	kobject_del(&c->kobj);
-	kobject_put(&c->kobj);
+	kobject_del_and_put(&c->kobj);
 	wait_for_completion(&c->kobj_unregister);
 
 	kfree(c->stats);
-- 
2.35.1


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

* [PATCH v2, RESEND 06/10] btrfs: convert to kobject_del_and_put()
  2023-03-19  9:26 [PATCH v2, RESEND 01/10] kobject: introduce kobject_del_and_put() Yangtao Li
                   ` (3 preceding siblings ...)
  2023-03-19  9:26 ` [PATCH v2, RESEND 05/10] ubifs: " Yangtao Li
@ 2023-03-19  9:26 ` Yangtao Li
  2023-03-20 15:54   ` David Sterba
  2023-03-19  9:26 ` [PATCH v2, RESEND 07/10] xfs: " Yangtao Li
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Yangtao Li @ 2023-03-19  9:26 UTC (permalink / raw)
  To: Chris Mason, Josef Bacik, David Sterba
  Cc: Yangtao Li, Greg Kroah-Hartman, Rafael J. Wysocki, linux-btrfs,
	linux-kernel

Use kobject_del_and_put() to simplify code.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 fs/btrfs/block-group.c |  5 +----
 fs/btrfs/sysfs.c       | 38 ++++++++++++--------------------------
 2 files changed, 13 insertions(+), 30 deletions(-)

diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
index 5fc670c27f86..a2876235c6dc 100644
--- a/fs/btrfs/block-group.c
+++ b/fs/btrfs/block-group.c
@@ -1125,10 +1125,7 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans,
 	}
 	up_write(&block_group->space_info->groups_sem);
 	clear_incompat_bg_bits(fs_info, block_group->flags);
-	if (kobj) {
-		kobject_del(kobj);
-		kobject_put(kobj);
-	}
+	kobject_del_and_put(kobj);
 
 	if (block_group->cached == BTRFS_CACHE_STARTED)
 		btrfs_wait_block_group_cache_done(block_group);
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index 37fc58a7f27e..49b837561135 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -1390,20 +1390,17 @@ static int addrm_unknown_feature_attrs(struct btrfs_fs_info *fs_info, bool add)
 static void __btrfs_sysfs_remove_fsid(struct btrfs_fs_devices *fs_devs)
 {
 	if (fs_devs->devinfo_kobj) {
-		kobject_del(fs_devs->devinfo_kobj);
-		kobject_put(fs_devs->devinfo_kobj);
+		kobject_del_and_put(fs_devs->devinfo_kobj);
 		fs_devs->devinfo_kobj = NULL;
 	}
 
 	if (fs_devs->devices_kobj) {
-		kobject_del(fs_devs->devices_kobj);
-		kobject_put(fs_devs->devices_kobj);
+		kobject_del_and_put(fs_devs->devices_kobj);
 		fs_devs->devices_kobj = NULL;
 	}
 
 	if (fs_devs->fsid_kobj.state_initialized) {
-		kobject_del(&fs_devs->fsid_kobj);
-		kobject_put(&fs_devs->fsid_kobj);
+		kobject_del_and_put(&fs_devs->fsid_kobj);
 		wait_for_completion(&fs_devs->kobj_unregister);
 	}
 }
@@ -1445,19 +1442,16 @@ void btrfs_sysfs_remove_mounted(struct btrfs_fs_info *fs_info)
 
 	if (fs_info->space_info_kobj) {
 		sysfs_remove_files(fs_info->space_info_kobj, allocation_attrs);
-		kobject_del(fs_info->space_info_kobj);
-		kobject_put(fs_info->space_info_kobj);
+		kobject_del_and_put(fs_info->space_info_kobj);
 	}
 	if (fs_info->discard_kobj) {
 		sysfs_remove_files(fs_info->discard_kobj, discard_attrs);
-		kobject_del(fs_info->discard_kobj);
-		kobject_put(fs_info->discard_kobj);
+		kobject_del_and_put(fs_info->discard_kobj);
 	}
 #ifdef CONFIG_BTRFS_DEBUG
 	if (fs_info->debug_kobj) {
 		sysfs_remove_files(fs_info->debug_kobj, btrfs_debug_mount_attrs);
-		kobject_del(fs_info->debug_kobj);
-		kobject_put(fs_info->debug_kobj);
+		kobject_del_and_put(fs_info->debug_kobj);
 	}
 #endif
 	addrm_unknown_feature_attrs(fs_info, false);
@@ -1620,13 +1614,9 @@ void btrfs_sysfs_remove_space_info(struct btrfs_space_info *space_info)
 
 		kobj = space_info->block_group_kobjs[i];
 		space_info->block_group_kobjs[i] = NULL;
-		if (kobj) {
-			kobject_del(kobj);
-			kobject_put(kobj);
-		}
+		kobject_del_and_put(kobj);
 	}
-	kobject_del(&space_info->kobj);
-	kobject_put(&space_info->kobj);
+	kobject_del_and_put(&space_info->kobj);
 }
 
 static const char *alloc_name(u64 flags)
@@ -1681,8 +1671,7 @@ void btrfs_sysfs_remove_device(struct btrfs_device *device)
 		sysfs_remove_link(devices_kobj, bdev_kobj(device->bdev)->name);
 
 	if (device->devid_kobj.state_initialized) {
-		kobject_del(&device->devid_kobj);
-		kobject_put(&device->devid_kobj);
+		kobject_del_and_put(&device->devid_kobj);
 		wait_for_completion(&device->kobj_unregister);
 	}
 }
@@ -2255,8 +2244,7 @@ void btrfs_sysfs_del_qgroups(struct btrfs_fs_info *fs_info)
 					     &fs_info->qgroup_tree, node)
 		btrfs_sysfs_del_one_qgroup(fs_info, qgroup);
 	if (fs_info->qgroups_kobj) {
-		kobject_del(fs_info->qgroups_kobj);
-		kobject_put(fs_info->qgroups_kobj);
+		kobject_del_and_put(fs_info->qgroups_kobj);
 		fs_info->qgroups_kobj = NULL;
 	}
 }
@@ -2304,10 +2292,8 @@ void btrfs_sysfs_del_one_qgroup(struct btrfs_fs_info *fs_info,
 	if (test_bit(BTRFS_FS_STATE_DUMMY_FS_INFO, &fs_info->fs_state))
 		return;
 
-	if (qgroup->kobj.state_initialized) {
-		kobject_del(&qgroup->kobj);
-		kobject_put(&qgroup->kobj);
-	}
+	if (qgroup->kobj.state_initialized)
+		kobject_del_and_put(&qgroup->kobj);
 }
 
 /*
-- 
2.35.1


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

* [PATCH v2, RESEND 07/10] xfs: convert to kobject_del_and_put()
  2023-03-19  9:26 [PATCH v2, RESEND 01/10] kobject: introduce kobject_del_and_put() Yangtao Li
                   ` (4 preceding siblings ...)
  2023-03-19  9:26 ` [PATCH v2, RESEND 06/10] btrfs: " Yangtao Li
@ 2023-03-19  9:26 ` Yangtao Li
  2023-03-20 14:58   ` Darrick J. Wong
  2023-03-19  9:26 ` [PATCH v2, RESEND 08/10] ocfs2: " Yangtao Li
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Yangtao Li @ 2023-03-19  9:26 UTC (permalink / raw)
  To: Darrick J. Wong
  Cc: Yangtao Li, Greg Kroah-Hartman, Rafael J. Wysocki, linux-xfs,
	linux-kernel

Use kobject_del_and_put() to simplify code.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 fs/xfs/xfs_sysfs.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/xfs/xfs_sysfs.h b/fs/xfs/xfs_sysfs.h
index 148893ebfdef..e2ff063e2c29 100644
--- a/fs/xfs/xfs_sysfs.h
+++ b/fs/xfs/xfs_sysfs.h
@@ -48,8 +48,7 @@ static inline void
 xfs_sysfs_del(
 	struct xfs_kobj	*kobj)
 {
-	kobject_del(&kobj->kobject);
-	kobject_put(&kobj->kobject);
+	kobject_del_and_put(&kobj->kobject);
 	wait_for_completion(&kobj->complete);
 }
 
-- 
2.35.1


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

* [PATCH v2, RESEND 08/10] ocfs2: convert to kobject_del_and_put()
  2023-03-19  9:26 [PATCH v2, RESEND 01/10] kobject: introduce kobject_del_and_put() Yangtao Li
                   ` (5 preceding siblings ...)
  2023-03-19  9:26 ` [PATCH v2, RESEND 07/10] xfs: " Yangtao Li
@ 2023-03-19  9:26 ` Yangtao Li
  2023-03-20  3:35   ` Joseph Qi
  2023-03-19  9:26 ` [PATCH v2, RESEND 09/10] nfs: " Yangtao Li
  2023-03-19  9:26 ` [PATCH v2, RESEND 10/10] nilfs2: " Yangtao Li
  8 siblings, 1 reply; 19+ messages in thread
From: Yangtao Li @ 2023-03-19  9:26 UTC (permalink / raw)
  To: Mark Fasheh, Joel Becker, Joseph Qi
  Cc: Yangtao Li, Greg Kroah-Hartman, Rafael J. Wysocki, ocfs2-devel,
	linux-kernel

Use kobject_del_and_put() to simplify code.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 fs/ocfs2/filecheck.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/ocfs2/filecheck.c b/fs/ocfs2/filecheck.c
index 1ad7106741f8..fb9cf601245b 100644
--- a/fs/ocfs2/filecheck.c
+++ b/fs/ocfs2/filecheck.c
@@ -198,8 +198,7 @@ void ocfs2_filecheck_remove_sysfs(struct ocfs2_super *osb)
 	if (!osb->osb_fc_ent.fs_fcheck)
 		return;
 
-	kobject_del(&osb->osb_fc_ent.fs_kobj);
-	kobject_put(&osb->osb_fc_ent.fs_kobj);
+	kobject_del_and_put(&osb->osb_fc_ent.fs_kobj);
 	wait_for_completion(&osb->osb_fc_ent.fs_kobj_unregister);
 	ocfs2_filecheck_sysfs_free(&osb->osb_fc_ent);
 }
-- 
2.35.1


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

* [PATCH v2, RESEND 09/10] nfs: convert to kobject_del_and_put()
  2023-03-19  9:26 [PATCH v2, RESEND 01/10] kobject: introduce kobject_del_and_put() Yangtao Li
                   ` (6 preceding siblings ...)
  2023-03-19  9:26 ` [PATCH v2, RESEND 08/10] ocfs2: " Yangtao Li
@ 2023-03-19  9:26 ` Yangtao Li
  2023-03-19  9:26 ` [PATCH v2, RESEND 10/10] nilfs2: " Yangtao Li
  8 siblings, 0 replies; 19+ messages in thread
From: Yangtao Li @ 2023-03-19  9:26 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker
  Cc: Yangtao Li, Greg Kroah-Hartman, Rafael J. Wysocki, linux-nfs,
	linux-kernel

Use kobject_del_and_put() to simplify code.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 fs/nfs/sysfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/nfs/sysfs.c b/fs/nfs/sysfs.c
index 0cbcd2dfa732..a6072be5fa5a 100644
--- a/fs/nfs/sysfs.c
+++ b/fs/nfs/sysfs.c
@@ -185,8 +185,7 @@ void nfs_netns_sysfs_destroy(struct nfs_net *netns)
 
 	if (clp) {
 		kobject_uevent(&clp->kobject, KOBJ_REMOVE);
-		kobject_del(&clp->kobject);
-		kobject_put(&clp->kobject);
+		kobject_del_and_put(&clp->kobject);
 		netns->nfs_client = NULL;
 	}
 }
-- 
2.35.1


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

* [PATCH v2, RESEND 10/10] nilfs2: convert to kobject_del_and_put()
  2023-03-19  9:26 [PATCH v2, RESEND 01/10] kobject: introduce kobject_del_and_put() Yangtao Li
                   ` (7 preceding siblings ...)
  2023-03-19  9:26 ` [PATCH v2, RESEND 09/10] nfs: " Yangtao Li
@ 2023-03-19  9:26 ` Yangtao Li
  8 siblings, 0 replies; 19+ messages in thread
From: Yangtao Li @ 2023-03-19  9:26 UTC (permalink / raw)
  To: Ryusuke Konishi
  Cc: Yangtao Li, Greg Kroah-Hartman, Rafael J. Wysocki, linux-nilfs,
	linux-kernel

Use kobject_del_and_put() to simplify code.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 fs/nilfs2/sysfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/nilfs2/sysfs.c b/fs/nilfs2/sysfs.c
index 379d22e28ed6..150965d58ca5 100644
--- a/fs/nilfs2/sysfs.c
+++ b/fs/nilfs2/sysfs.c
@@ -1042,8 +1042,7 @@ void nilfs_sysfs_delete_device_group(struct the_nilfs *nilfs)
 	nilfs_sysfs_delete_segments_group(nilfs);
 	nilfs_sysfs_delete_superblock_group(nilfs);
 	nilfs_sysfs_delete_segctor_group(nilfs);
-	kobject_del(&nilfs->ns_dev_kobj);
-	kobject_put(&nilfs->ns_dev_kobj);
+	kobject_del_and_put(&nilfs->ns_dev_kobj);
 	kfree(nilfs->ns_dev_subgroups);
 }
 
-- 
2.35.1


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

* Re: [PATCH v2, RESEND 04/10] zonefs: convert to kobject_del_and_put()
  2023-03-19  9:26 ` [PATCH v2, RESEND 04/10] zonefs: " Yangtao Li
@ 2023-03-19 21:42   ` Damien Le Moal
  0 siblings, 0 replies; 19+ messages in thread
From: Damien Le Moal @ 2023-03-19 21:42 UTC (permalink / raw)
  To: Yangtao Li, Naohiro Aota, Johannes Thumshirn
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, linux-fsdevel, linux-kernel

On 3/19/23 18:26, Yangtao Li wrote:
> Use kobject_del_and_put() to simplify code.
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
>  fs/zonefs/sysfs.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/zonefs/sysfs.c b/fs/zonefs/sysfs.c
> index 8ccb65c2b419..5e117188fbb5 100644
> --- a/fs/zonefs/sysfs.c
> +++ b/fs/zonefs/sysfs.c
> @@ -113,8 +113,7 @@ void zonefs_sysfs_unregister(struct super_block *sb)
>  	if (!sbi || !sbi->s_sysfs_registered)
>  		return;
>  
> -	kobject_del(&sbi->s_kobj);
> -	kobject_put(&sbi->s_kobj);
> +	kobject_del_and_put(&sbi->s_kobj);
>  	wait_for_completion(&sbi->s_kobj_unregister);

There is no function kobject_del_and_put() in rc3. I guess it is introduced by
this series but since you did not send everything, it is impossible to review.
Please always send the full patch series so that reviewers have all the context
that is needed to review/ack.

>  }
>  

-- 
Damien Le Moal
Western Digital Research


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

* Re: [PATCH v2, RESEND 05/10] ubifs: convert to kobject_del_and_put()
  2023-03-19  9:26 ` [PATCH v2, RESEND 05/10] ubifs: " Yangtao Li
@ 2023-03-20  2:55   ` Zhihao Cheng
  0 siblings, 0 replies; 19+ messages in thread
From: Zhihao Cheng @ 2023-03-20  2:55 UTC (permalink / raw)
  To: Yangtao Li, Richard Weinberger
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, linux-mtd, linux-kernel

Hi Yangtao,
> Use kobject_del_and_put() to simplify code.
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
>   fs/ubifs/sysfs.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/ubifs/sysfs.c b/fs/ubifs/sysfs.c
> index 1c958148bb87..9571718e61a9 100644
> --- a/fs/ubifs/sysfs.c
> +++ b/fs/ubifs/sysfs.c
> @@ -130,8 +130,7 @@ int ubifs_sysfs_register(struct ubifs_info *c)
>   
>   void ubifs_sysfs_unregister(struct ubifs_info *c)
>   {
> -	kobject_del(&c->kobj);
> -	kobject_put(&c->kobj);
> +	kobject_del_and_put(&c->kobj);
>   	wait_for_completion(&c->kobj_unregister);
>   
>   	kfree(c->stats);
> 

Maybe you can send the entire patchset to linux-mtd next time, I can 
only see patch 5 from the maillist. After confirming from other 
website(https://www.spinics.net/lists/kernel/msg4727274.html) I see you 
instroduced the implementation of kobject_del_and_put().

I have no objections if other modules can accept the kobject_del_and_put().

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

* Re: [PATCH v2, RESEND 08/10] ocfs2: convert to kobject_del_and_put()
  2023-03-19  9:26 ` [PATCH v2, RESEND 08/10] ocfs2: " Yangtao Li
@ 2023-03-20  3:35   ` Joseph Qi
  0 siblings, 0 replies; 19+ messages in thread
From: Joseph Qi @ 2023-03-20  3:35 UTC (permalink / raw)
  To: Yangtao Li, Mark Fasheh, Joel Becker
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, ocfs2-devel, linux-kernel



On 3/19/23 5:26 PM, Yangtao Li wrote:
> Use kobject_del_and_put() to simplify code.
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
>  fs/ocfs2/filecheck.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/ocfs2/filecheck.c b/fs/ocfs2/filecheck.c
> index 1ad7106741f8..fb9cf601245b 100644
> --- a/fs/ocfs2/filecheck.c
> +++ b/fs/ocfs2/filecheck.c
> @@ -198,8 +198,7 @@ void ocfs2_filecheck_remove_sysfs(struct ocfs2_super *osb)
>  	if (!osb->osb_fc_ent.fs_fcheck)
>  		return;
>  
> -	kobject_del(&osb->osb_fc_ent.fs_kobj);
> -	kobject_put(&osb->osb_fc_ent.fs_kobj);
> +	kobject_del_and_put(&osb->osb_fc_ent.fs_kobj);
>  	wait_for_completion(&osb->osb_fc_ent.fs_kobj_unregister);
>  	ocfs2_filecheck_sysfs_free(&osb->osb_fc_ent);
>  }

Can't find any implementation of kobject_del_and_put() in mainline.
So I guess you've introduced it at the beginning of this series? Since I
can only see this one:(
So it depends on kobject lib. If kobject lib accepts this helper, it's
fine to me.

Thanks,
Joseph

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

* Re: [PATCH v2, RESEND 07/10] xfs: convert to kobject_del_and_put()
  2023-03-19  9:26 ` [PATCH v2, RESEND 07/10] xfs: " Yangtao Li
@ 2023-03-20 14:58   ` Darrick J. Wong
  0 siblings, 0 replies; 19+ messages in thread
From: Darrick J. Wong @ 2023-03-20 14:58 UTC (permalink / raw)
  To: Yangtao Li; +Cc: Greg Kroah-Hartman, Rafael J. Wysocki, linux-xfs, linux-kernel

On Sun, Mar 19, 2023 at 05:26:38PM +0800, Yangtao Li wrote:
> Use kobject_del_and_put() to simplify code.
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>

Looks good to me,
Acked-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  fs/xfs/xfs_sysfs.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/xfs_sysfs.h b/fs/xfs/xfs_sysfs.h
> index 148893ebfdef..e2ff063e2c29 100644
> --- a/fs/xfs/xfs_sysfs.h
> +++ b/fs/xfs/xfs_sysfs.h
> @@ -48,8 +48,7 @@ static inline void
>  xfs_sysfs_del(
>  	struct xfs_kobj	*kobj)
>  {
> -	kobject_del(&kobj->kobject);
> -	kobject_put(&kobj->kobject);
> +	kobject_del_and_put(&kobj->kobject);
>  	wait_for_completion(&kobj->complete);
>  }
>  
> -- 
> 2.35.1
> 

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

* Re: [PATCH v2, RESEND 06/10] btrfs: convert to kobject_del_and_put()
  2023-03-19  9:26 ` [PATCH v2, RESEND 06/10] btrfs: " Yangtao Li
@ 2023-03-20 15:54   ` David Sterba
  0 siblings, 0 replies; 19+ messages in thread
From: David Sterba @ 2023-03-20 15:54 UTC (permalink / raw)
  To: Yangtao Li
  Cc: Chris Mason, Josef Bacik, David Sterba, Greg Kroah-Hartman,
	Rafael J. Wysocki, linux-btrfs, linux-kernel

On Sun, Mar 19, 2023 at 05:26:37PM +0800, Yangtao Li wrote:
> Use kobject_del_and_put() to simplify code.
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>

Acked-by: David Sterba <dsterba@suse.com>

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

* Re: [PATCH v2, RESEND 01/10] kobject: introduce kobject_del_and_put()
  2023-03-20  7:11   ` Yangtao Li
@ 2023-03-20  7:26     ` Damien Le Moal
  0 siblings, 0 replies; 19+ messages in thread
From: Damien Le Moal @ 2023-03-20  7:26 UTC (permalink / raw)
  To: Yangtao Li, clm, josef, dsterba, xiang, chao, huyue2, jefflexu,
	jaegeuk, trond.myklebust, anna, konishi.ryusuke, mark, jlbec,
	joseph.qi, richard, djwong, naohiro.aota, jth, gregkh, rafael
  Cc: linux-btrfs, linux-kernel, linux-erofs, linux-f2fs-devel,
	linux-nfs, linux-nilfs, ocfs2-devel, linux-mtd, linux-xfs,
	linux-fsdevel

On 3/20/23 16:11, Yangtao Li wrote:
> Hi filesystem maintainers,
> 
>> Hard to comment on patches with this. It is only 10 patches. So send everything please.
> 
> If you are interested in the entire patchset besides Damien,
> please let me know. I'll resend the email later to cc more people.

Yes, I said I am interested, twice already. It is IMPOSSIBLE to review a patch
without the context of other patches before/after said patch. So if you want a
review/ack for zonefs, then send the entire series.

> 
> Thx,
> Yangtao

-- 
Damien Le Moal
Western Digital Research


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

* Re: [PATCH v2, RESEND 01/10] kobject: introduce kobject_del_and_put()
  2023-03-20  4:08 ` Damien Le Moal
@ 2023-03-20  7:11   ` Yangtao Li
  2023-03-20  7:26     ` Damien Le Moal
  0 siblings, 1 reply; 19+ messages in thread
From: Yangtao Li @ 2023-03-20  7:11 UTC (permalink / raw)
  To: clm, josef, dsterba, xiang, chao, huyue2, jefflexu, jaegeuk,
	trond.myklebust, anna, konishi.ryusuke, mark, jlbec, joseph.qi,
	richard, djwong, damien.lemoal, naohiro.aota, jth, gregkh,
	rafael
  Cc: linux-btrfs, linux-kernel, linux-erofs, linux-f2fs-devel,
	linux-nfs, linux-nilfs, ocfs2-devel, linux-mtd, linux-xfs,
	linux-fsdevel

Hi filesystem maintainers,

> Hard to comment on patches with this. It is only 10 patches. So send everything please.

If you are interested in the entire patchset besides Damien,
please let me know. I'll resend the email later to cc more people.

Thx,
Yangtao

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

* Re: [PATCH v2, RESEND 01/10] kobject: introduce kobject_del_and_put()
  2023-03-20  3:34 [PATCH v2, RESEND 01/10] kobject: introduce kobject_del_and_put() Yangtao Li
@ 2023-03-20  4:08 ` Damien Le Moal
  2023-03-20  7:11   ` Yangtao Li
  0 siblings, 1 reply; 19+ messages in thread
From: Damien Le Moal @ 2023-03-20  4:08 UTC (permalink / raw)
  To: Yangtao Li, clm, josef, dsterba, xiang, chao, huyue2, jefflexu,
	jaegeuk, trond.myklebust, anna, konishi.ryusuke, mark, jlbec,
	joseph.qi, richard, djwong, naohiro.aota, jth, gregkh, rafael
  Cc: linux-btrfs, linux-kernel, linux-erofs, linux-f2fs-devel,
	linux-nfs, linux-nilfs, ocfs2-devel, linux-mtd, linux-xfs,
	linux-fsdevel

On 3/20/23 12:34, Yangtao Li wrote:
> Hi all,
> 
> Out of consideration for minimizing disruption, I did not send the
> patchset to everyone. However, it seems that my consideration was
> unnecessary, so I CC'd everyone on the first patch. If you would
> like to see the entire patchset, you can access it at this address.
> 
> https://lore.kernel.org/lkml/20230319092641.41917-1-frank.li@vivo.com/

Hard to comment on patches with this. It is only 10 patches. So send everything
please.

> 
> Thx,
> Yangtao

-- 
Damien Le Moal
Western Digital Research


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

* Re: [PATCH v2, RESEND 01/10] kobject: introduce kobject_del_and_put()
@ 2023-03-20  3:34 Yangtao Li
  2023-03-20  4:08 ` Damien Le Moal
  0 siblings, 1 reply; 19+ messages in thread
From: Yangtao Li @ 2023-03-20  3:34 UTC (permalink / raw)
  To: clm, josef, dsterba, xiang, chao, huyue2, jefflexu, jaegeuk,
	trond.myklebust, anna, konishi.ryusuke, mark, jlbec, joseph.qi,
	richard, djwong, damien.lemoal, naohiro.aota, jth, gregkh,
	rafael
  Cc: linux-btrfs, linux-kernel, linux-erofs, linux-f2fs-devel,
	linux-nfs, linux-nilfs, ocfs2-devel, linux-mtd, linux-xfs,
	linux-fsdevel

Hi all,

Out of consideration for minimizing disruption, I did not send the
patchset to everyone. However, it seems that my consideration was
unnecessary, so I CC'd everyone on the first patch. If you would
like to see the entire patchset, you can access it at this address.

https://lore.kernel.org/lkml/20230319092641.41917-1-frank.li@vivo.com/

Thx,
Yangtao

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

end of thread, other threads:[~2023-03-20 16:12 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-19  9:26 [PATCH v2, RESEND 01/10] kobject: introduce kobject_del_and_put() Yangtao Li
2023-03-19  9:26 ` [PATCH v2, RESEND 02/10] f2fs: convert to kobject_del_and_put() Yangtao Li
2023-03-19  9:26 ` [PATCH v2, RESEND 03/10] erofs: " Yangtao Li
2023-03-19  9:26 ` [PATCH v2, RESEND 04/10] zonefs: " Yangtao Li
2023-03-19 21:42   ` Damien Le Moal
2023-03-19  9:26 ` [PATCH v2, RESEND 05/10] ubifs: " Yangtao Li
2023-03-20  2:55   ` Zhihao Cheng
2023-03-19  9:26 ` [PATCH v2, RESEND 06/10] btrfs: " Yangtao Li
2023-03-20 15:54   ` David Sterba
2023-03-19  9:26 ` [PATCH v2, RESEND 07/10] xfs: " Yangtao Li
2023-03-20 14:58   ` Darrick J. Wong
2023-03-19  9:26 ` [PATCH v2, RESEND 08/10] ocfs2: " Yangtao Li
2023-03-20  3:35   ` Joseph Qi
2023-03-19  9:26 ` [PATCH v2, RESEND 09/10] nfs: " Yangtao Li
2023-03-19  9:26 ` [PATCH v2, RESEND 10/10] nilfs2: " Yangtao Li
2023-03-20  3:34 [PATCH v2, RESEND 01/10] kobject: introduce kobject_del_and_put() Yangtao Li
2023-03-20  4:08 ` Damien Le Moal
2023-03-20  7:11   ` Yangtao Li
2023-03-20  7:26     ` Damien Le Moal

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