Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp2932558rwe; Sun, 16 Apr 2023 08:13:31 -0700 (PDT) X-Google-Smtp-Source: AKy350aAsdZJCMqvdmEup93BB7LprrMUvwhXMJX3M6l9kTDFo1abaPfXMB5NMQE7Ar5/0cx6Q2iP X-Received: by 2002:a05:6a21:32a5:b0:ee:f5a4:c064 with SMTP id yt37-20020a056a2132a500b000eef5a4c064mr2458951pzb.62.1681658011519; Sun, 16 Apr 2023 08:13:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681658011; cv=none; d=google.com; s=arc-20160816; b=UgOgY6Lw43QtQBddvd1fHb6mBmjB4KVLYGbnW3xEaQju7YzeuOnAnZCMb9lhEzBSiT 59rIjyaK61fwQyc97XjU7k6hfPuNGcL6UX5Tz1h68RsKyhsen/OFUVa/X+m2vs/Hg8ep dOb4XCt6twYwA+tnKNZWFWsjrtbkbolI8nxXFfi18MD6F9tudMiYi+Brif5T13AFv3C/ tNWcTQC1jcvX2t0W50tt3dPPBCjyS5h8u6H+dj0BVD/t5ygGT1GUVyBakcvbDR+iBil9 9j3bZBHN6OlgCFc/uWzZTZGotJc2xe59GhMzDz/0xhgBYsV4GJYoBAaXfeB3jIr3m/HE L14g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=YL1pTwSqLadM8eY+5FjJGOI8cGYShEkH/Bx/IlpnhRo=; b=tC/n+hGBc0pz+RWx1wi8DF1I1IxeC2wJlSYmpm8DjF1nqgmhZvxKOHedH4vQTqI1rQ 2ING347bfk3yZkiyhTnfoveOCJMC8yTu0qBH+GDfThAM4f0IOInCSJAoftElxM1Hnp3u hD9XLxla+pY7fpQcpToro84g1XebH5EHe7opwwPA5NX9cI4OgMvT0dZzwr/bdum8Gr8q 3n9DuLy31o78xXe1pWuIiTGF8UkIzBHGVwzavU7H5fsa+PSstOnMWJvkhd+41DsmlRfq uZDJCMcpknf6tDT2JRFNyFYSfnnMBICxGRjiB+om55uDivRXRzafO3woMIRYH4PcsjyF IxhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hCVuB8yr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p65-20020a622944000000b0063b85b516ffsi3096750pfp.106.2023.04.16.08.13.20; Sun, 16 Apr 2023 08:13:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hCVuB8yr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229782AbjDPPCG (ORCPT + 99 others); Sun, 16 Apr 2023 11:02:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229592AbjDPPCE (ORCPT ); Sun, 16 Apr 2023 11:02:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7F37A6 for ; Sun, 16 Apr 2023 08:02:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8190460DF7 for ; Sun, 16 Apr 2023 15:02:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D409C433D2; Sun, 16 Apr 2023 15:02:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681657322; bh=MRLPHEMwkW7WtKO6pZWkp15qzWsjqubLCzvGyJsu/gw=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=hCVuB8yr+cjKfsx9+UMEaxFNnhPLJ4Ud+BU1t/wrEJlnVGGe4X1ZMyoCsYXChhKJ9 O2Ku+sR6dgueUk8pA4rjo9Xajjy7navCG5+Skt1KmeEV9PBj0TYcQWC+Rx9pOvHXaP u+WNUu5NFs4KzgRmv4qB72R7qnWvIlGYX5g+5czJWCdbMxp/WTPpf8rBJ92dddviPj LpzjQehLx2tHpbDm7rTt4A045YVD0kREAkaKBImSesYNhJllqzUaCQJDQbMRfj0E04 DxdFFDisoPV/uVQvoEKx/qenqN7i8h7ryJxi7+zKcDxw3/PwdXnWg4A86Yu2wjJ04O G7CFTY714L7Og== Message-ID: Date: Sun, 16 Apr 2023 23:02:00 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH] f2fs: remove bulk remove_proc_entry() and unnecessary kobject_del() Content-Language: en-US To: Jaegeuk Kim Cc: Yangtao Li , linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org References: <20230406191629.63024-1-frank.li@vivo.com> <2e41d6e0-13bb-fa5d-00aa-75865b8e7c34@kernel.org> From: Chao Yu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >>> --- >>> 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 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); >>> }