Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1421209rwb; Wed, 9 Nov 2022 18:05:33 -0800 (PST) X-Google-Smtp-Source: AMsMyM5FJ1tFcElqVS+/H7nDQpQz+K/s5YEJPhiNT5ihcx460zwAfVa6ehviqoRwTW4ahO4KSRB0 X-Received: by 2002:a05:6a00:2987:b0:56c:636a:ac94 with SMTP id cj7-20020a056a00298700b0056c636aac94mr1536923pfb.38.1668045933147; Wed, 09 Nov 2022 18:05:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668045933; cv=none; d=google.com; s=arc-20160816; b=dkaDc6286oIkcNDacJDL6qYE8oU0RWd4jrD04xf9QlEImdzmaw+gXfFIkbYeNCFGrQ uW62/IvIpHuRKULNmuoIOOqaj988oa2OfZrBXrfMi4Qj8XbGlngqAroeeBgDmA+my89P E3dk0QMRKJjHnwEP8jGM/yXj1DMDVuJRBRQUbUfNBd1KXZizF6Qd2wJ+WwlXPtnjZuQO 78fs5NpK7fHgKA8lRaRvOrJhhQ3OoXqrHSrnEPUIJr0+8d8fpx5r7m/fptQE08mzLo0y bivHN+7XNUgj8C+D57RVJOKh7F2YHT1SDb7up6OxPgnfwv6BM1qtUFObeavYuOpXGmKc UDdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=GDZAzeRm4rt8DbuakyTGfLBafQIt7e0Br+7aABx+tSU=; b=MrqOPdXQjRP+ec+DbXIWmfc/QNSOCE8cFSyJSYgbgR20FAN1AaVCI8rnIBhJvgAS7a mxWlYMV/2nTGApEssvKglHwEXndz2J0cqmN/BMkLx2wsaYUpvJJgMQKnztObdl66+rNT UXck7cCwHHI15qVccalKvoNFFiXO6lz0DV7EeYwNVAeZGhXz2+KMMiTSeRgcy8kDuCE9 COmUjla07C6QoXi6Vlzncuj0np08AbQaLp39U8DN/WdjAgUpNEcbCYYZyBL5dR81HHkP kFYczwh38whGRmQDJFd5VQPcMwqnwOyXorQoSjgAYe+JxaqmSseS6eY06NjcZWbuJS3Z hRtg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hk11-20020a17090b224b00b001fd7d02c976si3573667pjb.87.2022.11.09.18.05.15; Wed, 09 Nov 2022 18:05:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-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; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232441AbiKJCE7 (ORCPT + 99 others); Wed, 9 Nov 2022 21:04:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232585AbiKJCEf (ORCPT ); Wed, 9 Nov 2022 21:04:35 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5455EBE5 for ; Wed, 9 Nov 2022 18:04:33 -0800 (PST) Received: from canpemm500005.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4N74s13cxjzRp7B; Thu, 10 Nov 2022 10:04:21 +0800 (CST) Received: from huawei.com (10.175.127.227) by canpemm500005.china.huawei.com (7.192.104.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 10 Nov 2022 10:04:31 +0800 From: Zhang Yi To: CC: , , , , Subject: [PATCH v2 01/12] ext4: add debugfs interface Date: Thu, 10 Nov 2022 10:25:47 +0800 Message-ID: <20221110022558.7844-2-yi.zhang@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221110022558.7844-1-yi.zhang@huawei.com> References: <20221110022558.7844-1-yi.zhang@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500005.china.huawei.com (7.192.104.229) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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-ext4@vger.kernel.org Add debugfs interface support, preparing to introduce fault injection facility. Signed-off-by: Zhang Yi --- fs/ext4/ext4.h | 1 + fs/ext4/sysfs.c | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 8d5453852f98..53099ffe307f 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -1551,6 +1551,7 @@ struct ext4_sb_info { struct percpu_counter s_sra_exceeded_retry_limit; struct blockgroup_lock *s_blockgroup_lock; struct proc_dir_entry *s_proc; + struct dentry *s_debug; struct kobject s_kobj; struct completion s_kobj_unregister; struct super_block *s_sb; diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c index d233c24ea342..f3e4049ec50e 100644 --- a/fs/ext4/sysfs.c +++ b/fs/ext4/sysfs.c @@ -14,6 +14,7 @@ #include #include #include +#include #include "ext4.h" #include "ext4_jbd2.h" @@ -59,6 +60,8 @@ struct ext4_attr { } u; }; +static struct dentry *ext4_debugfs_root; + static ssize_t session_write_kbytes_show(struct ext4_sb_info *sbi, char *buf) { struct super_block *sb = sbi->s_buddy_cache->i_sb; @@ -548,6 +551,8 @@ int ext4_register_sysfs(struct super_block *sb) proc_create_seq_data("mb_structs_summary", 0444, sbi->s_proc, &ext4_mb_seq_structs_summary_ops, sb); } + if (ext4_debugfs_root) + sbi->s_debug = debugfs_create_dir(sb->s_id, ext4_debugfs_root); return 0; } @@ -555,6 +560,7 @@ void ext4_unregister_sysfs(struct super_block *sb) { struct ext4_sb_info *sbi = EXT4_SB(sb); + debugfs_remove_recursive(sbi->s_debug); if (sbi->s_proc) remove_proc_subtree(sb->s_id, ext4_proc_root); kobject_del(&sbi->s_kobj); @@ -580,6 +586,7 @@ int __init ext4_init_sysfs(void) goto feat_err; ext4_proc_root = proc_mkdir(proc_dirname, NULL); + ext4_debugfs_root = debugfs_create_dir("ext4", NULL); return ret; feat_err: @@ -599,5 +606,6 @@ void ext4_exit_sysfs(void) ext4_root = NULL; remove_proc_entry(proc_dirname, NULL); ext4_proc_root = NULL; + debugfs_remove_recursive(ext4_debugfs_root); + ext4_debugfs_root = NULL; } - -- 2.31.1