From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2CBD1C6FD1C for ; Mon, 20 Mar 2023 21:54:55 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1peNSu-00050v-7M; Mon, 20 Mar 2023 21:54:52 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1peNSs-00050p-32 for linux-f2fs-devel@lists.sourceforge.net; Mon, 20 Mar 2023 21:54:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: From:References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=b9zEtHDic9UqpNQ2nmRpZrwUWVXEUTDBm4dZnh94WWk=; b=Br4iBBf/wiQXzOqS5Vd+dNAWNu 16Ogl++/BZCHdz587QhJPOnZ/ug6987ybSILga+hKiErA6Z0egunv06Vaz7Ms2uzZ++iSGsKoOnMM rIwRcmzkQSb37C4aUyeEmAF5Jv7ZcF7aInu0HJhpVVjNgUCS1V5w1yVtEdRv4gSLDNnQ=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=b9zEtHDic9UqpNQ2nmRpZrwUWVXEUTDBm4dZnh94WWk=; b=EEk6p+N30mDxkajO40CnwT9uaf NtT7L3GH26EU8XMXH5RG3SRuiq797ZFEMWgFXnVQTEEykf/rIiUgZcgeLEEcYgRHvA/4qOtAudkcF J1S1Wks9qLouXPbsMuP5Cjn79jxKUWhZlo5I0nUaLSzzi3caNIPb5RPYxsHSrbxaSzsM=; Received: from esa1.hgst.iphmx.com ([68.232.141.245]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1peNSo-00EcBb-3z for linux-f2fs-devel@lists.sourceforge.net; Mon, 20 Mar 2023 21:54:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1679349285; x=1710885285; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=bxVzq8suDNih9SH1Ok62kaz7FvxQWlE5bz197aYsbjU=; b=ogT55WsrGXrnmoCEGE69RhzMVZg7R0Wn/hCdofB3pa+mDrXWi/r+L/ja Was9PEVYfCIKJQ018BD0yKuyKDoqZknaNhTR6JeW9qaTXXszGL7uUeb9Y StOH+Zti+Mddx8W6UK2fjGgyjAkAZoJl/GTh/wDSsB+PJcQDNjWdYaDyv bgHvlROLvUlI+8ML8kjfbdDj08hUQ5A0/1UrwrfM5h9qhATAQ+zf1R6QF bjEhwmyPREvG69p9e2ZFVzz11BXCZ+H7Um+2GEdT6L5A3qrK/BL02SYnb NYeIzhG0WpM5n/Z6pr1HT38RhV6Syrg6u0gmxdtAzyBrEDEOezfGxyNhq Q==; X-IronPort-AV: E=Sophos;i="5.98,276,1673884800"; d="scan'208";a="338129578" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 21 Mar 2023 05:39:07 +0800 IronPort-SDR: 7rFg/wZH4T4BCbJoj2t05ERLTfRoPCGcq+EBF253gCH3X7AkfbxajNyC8soHc7wKjJ+1eIOAd2 AwrRqZrE/bMCC+Ku6xZcojasRE+NU/P7VY6JE8O1BaxkxQAICqMWE4SFjMxEugJ/H05kiYZThs thnowg0NFbjxwT5/t/hCFyHVN1dacexi6Ou4EQ2xAW3AUX/uNFkXH/Vb+D9B1CF54rCTU/ihc2 fIUAoB2Ry1n6dagZuykDCEZARg6fmmz5BY7OhWOyzYpC18/0v3FtFLLYf3geAyq+uJAy/PPbs7 sTk= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 20 Mar 2023 13:49:46 -0700 IronPort-SDR: bBSIY7RMib8CZeLsuMMDcDyt5jGfXWiqSWSFTUveVHFrb37ZYeCIKnBmkJtY0FX7KnyyruGW40 RsbgvXzNTsiXuxBqXJjQvP+9KCjibIPwSvla4oOieJIJhzWptAH9mahky8sLG+lWG6zBrL2YdW Ps6jE3HxdaUuDUkolIwf/VisbZE0faK/4sezyrrtwxk4FkCjbc6oRYIZwuN3uwAJZRIG5c8hDI uq/LJlBfCtx9sphE0Dg18fWCXRvEBS5JqDBp4oIpIwzHfiLzVIlsjlhz7Th6kQDw1+E4KmDLZp 3nk= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 20 Mar 2023 14:39:07 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4PgSmV73xQz1RtVq for ; Mon, 20 Mar 2023 14:39:06 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:content-type :in-reply-to:organization:from:references:to:content-language :subject:user-agent:mime-version:date:message-id; s=dkim; t= 1679348345; x=1681940346; bh=bxVzq8suDNih9SH1Ok62kaz7FvxQWlE5bz1 97aYsbjU=; b=EKxs8rpUot/qFRHAvND09IIAv6cqU/2Lev47PpifnoY6Vn42PvZ bLqMSLk5W+AyQuqTGKwodJfY4iDfhinl9cyIK7N2mtXEWEbGsMTiKxFf0DCuYwfv U7tD4WDxe1pbv3HNUfmVAdcHrTAMKvexZTU0GM1jYO4oNPGmPiD77lxKs2Zw8Hzb PwIdTneUr52J5sAiu9A7XMDGoEBHZesZf8Ek4BS/umk2gVFaA1nuC+gmt+D5Qto6 f5pqaIAayhxw2wlTZV+cAvKH6KJ3w/adruI7wi3ZwobRCy9apzq/Jd2TLBhGAwdK dxo6IBbJ/jukaj9W89Dx0kqPLMgyapwzAcw== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ZkS8c99CiSvk for ; Mon, 20 Mar 2023 14:39:05 -0700 (PDT) Received: from [10.225.163.91] (unknown [10.225.163.91]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4PgSmM4CNrz1RtVm; Mon, 20 Mar 2023 14:38:59 -0700 (PDT) Message-ID: <2229e074-d78e-3bd5-bf06-a53e9ad57d02@opensource.wdc.com> Date: Tue, 21 Mar 2023 06:38:58 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Content-Language: en-US To: Yangtao Li , clm@fb.com, josef@toxicpanda.com, dsterba@suse.com, xiang@kernel.org, chao@kernel.org, huyue2@coolpad.com, jefflexu@linux.alibaba.com, jaegeuk@kernel.org, trond.myklebust@hammerspace.com, anna@kernel.org, konishi.ryusuke@gmail.com, mark@fasheh.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com, richard@nod.at, djwong@kernel.org, naohiro.aota@wdc.com, jth@kernel.org, gregkh@linuxfoundation.org, rafael@kernel.org References: <20230320184657.56198-1-frank.li@vivo.com> Organization: Western Digital Research In-Reply-To: <20230320184657.56198-1-frank.li@vivo.com> X-Headers-End: 1peNSo-00EcBb-3z Subject: Re: [f2fs-dev] [RESEND, PATCH v2 01/10] kobject: introduce kobject_del_and_put() X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Damien Le Moal via Linux-f2fs-devel Reply-To: Damien Le Moal Cc: linux-nfs@vger.kernel.org, linux-nilfs@vger.kernel.org, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, linux-mtd@lists.infradead.org, ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, linux-erofs@lists.ozlabs.org, linux-btrfs@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On 3/21/23 03:46, Yangtao Li wrote: > 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 > --- > v2: > -add kobject_del_and_put() users > resend patchset to gregkh, Rafael and Damien > 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); Why not make this an inline helper defined in include/linux/kobject.h instead of a new symbol ? > + > 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); > -- Damien Le Moal Western Digital Research _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel