From patchwork Wed Aug 18 06:01:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venky Shankar X-Patchwork-Id: 499815 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 660B1C4320E for ; Wed, 18 Aug 2021 06:01:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4FFC461076 for ; Wed, 18 Aug 2021 06:01:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237974AbhHRGCX (ORCPT ); Wed, 18 Aug 2021 02:02:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:55534 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237984AbhHRGCW (ORCPT ); Wed, 18 Aug 2021 02:02:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629266507; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Txdk+Z9WcFuAe77116wHEI/E4dD4MCi85B9Czbih7K0=; b=UYH2IAuweRJ9gajdsEK6P7HvMzbL1YDeNwjjpGTB6TPMAIOaBixZ862LEghlM6OyYrLVQb UMnGkAHNMo4KVuKKJODjJND2S3TeThUUgmpL9q7BtpuISCLt1lHfYl8QvvgpGe3Ib+k0dp 9i8/WXT+sq7dRuMd9DG+8M4A5/153AQ= Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-62-_FORBV98MmyoS1WPVhG4OQ-1; Wed, 18 Aug 2021 02:01:46 -0400 X-MC-Unique: _FORBV98MmyoS1WPVhG4OQ-1 Received: by mail-pg1-f199.google.com with SMTP id t28-20020a63461c000000b00252078b83e4so797129pga.15 for ; Tue, 17 Aug 2021 23:01:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Txdk+Z9WcFuAe77116wHEI/E4dD4MCi85B9Czbih7K0=; b=j6yzmNR9HptUGz7w6xmPBrbykb805TIvfS6RCA+QnUFRsQguXQAWVCMwbtg1t1BJXY jVbtcXxYYe3r4YqSUWBzidMP1MHFezTlpu39oVW1LdtK1IWDDshwq06MqiUeYiZrA1no SX1dvovpnj4Ee8fL06zlzZ+getLp0UuEyZQvmYCwRtDH3lt4iogG6yqda+MTNJVw8dLZ vymQTpbb0Sz0GCFrrpMYJUBBn77HFi5soPsaKYC5Wa0NndJpjYue++1wVGD/FdFRe2Gp XNTHCG4GCb6zdP+6sfy+ChtuIp8l3a4EdnV8F0ZTDfKFA/dnIOZ/wSG6UJQmkZXoWKHm TCMw== X-Gm-Message-State: AOAM5329egXZMlfoFkP7srKgf9V2shdq5i/MlrHb3dkyEMXPHhBggUom 1PrZ8aQ/uasIbSK1RTzS5oLF01FhcwKksqUWHminnRRACTJP0rzTSXgKrqYdDItnWCspp1inobL h0WI7AeJ25DfQ1h1aZRMymQ== X-Received: by 2002:a17:90a:a390:: with SMTP id x16mr7912258pjp.197.1629266505294; Tue, 17 Aug 2021 23:01:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvhtkie6FkTg4Ev6ppggEsvjNmGr3tRI+PRHMHs2R1bOcRy9ozhtg8szPk5SU/UYUkzhpbuA== X-Received: by 2002:a17:90a:a390:: with SMTP id x16mr7912247pjp.197.1629266505128; Tue, 17 Aug 2021 23:01:45 -0700 (PDT) Received: from localhost.localdomain ([49.207.198.118]) by smtp.gmail.com with ESMTPSA id m28sm5865111pgl.9.2021.08.17.23.01.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Aug 2021 23:01:44 -0700 (PDT) From: Venky Shankar To: jlayton@redhat.com, pdonnell@redhat.com Cc: ceph-devel@vger.kernel.org, Venky Shankar Subject: [RFC 1/2] ceph: add helpers to create/cleanup debugfs sub-directories under "ceph" directory Date: Wed, 18 Aug 2021 11:31:33 +0530 Message-Id: <20210818060134.208546-2-vshankar@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210818060134.208546-1-vshankar@redhat.com> References: <20210818060134.208546-1-vshankar@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Callers can use this helper to create a subdirectory under "ceph" directory in debugfs to place custom files for exporting information to userspace. Signed-off-by: Venky Shankar --- include/linux/ceph/debugfs.h | 3 +++ net/ceph/debugfs.c | 26 ++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/include/linux/ceph/debugfs.h b/include/linux/ceph/debugfs.h index 8b3a1a7a953a..c372e6cb8aae 100644 --- a/include/linux/ceph/debugfs.h +++ b/include/linux/ceph/debugfs.h @@ -10,5 +10,8 @@ extern void ceph_debugfs_cleanup(void); extern void ceph_debugfs_client_init(struct ceph_client *client); extern void ceph_debugfs_client_cleanup(struct ceph_client *client); +extern struct dentry *ceph_debugfs_create_subdir(const char *subdir); +extern void ceph_debugfs_cleanup_subdir(struct dentry *subdir_dentry); + #endif diff --git a/net/ceph/debugfs.c b/net/ceph/debugfs.c index 2110439f8a24..eabac20b3ff4 100644 --- a/net/ceph/debugfs.c +++ b/net/ceph/debugfs.c @@ -404,6 +404,18 @@ void ceph_debugfs_cleanup(void) debugfs_remove(ceph_debugfs_dir); } +struct dentry *ceph_debugfs_create_subdir(const char *subdir) +{ + return debugfs_create_dir(subdir, ceph_debugfs_dir); +} +EXPORT_SYMBOL(ceph_debugfs_create_subdir); + +void ceph_debugfs_cleanup_subdir(struct dentry *subdir_dentry) +{ + debugfs_remove(subdir_dentry); +} +EXPORT_SYMBOL(ceph_debugfs_cleanup_subdir); + void ceph_debugfs_client_init(struct ceph_client *client) { char name[80]; @@ -413,7 +425,7 @@ void ceph_debugfs_client_init(struct ceph_client *client) dout("ceph_debugfs_client_init %p %s\n", client, name); - client->debugfs_dir = debugfs_create_dir(name, ceph_debugfs_dir); + client->debugfs_dir = ceph_debugfs_create_subdir(name); client->monc.debugfs_file = debugfs_create_file("monc", 0400, @@ -454,7 +466,7 @@ void ceph_debugfs_client_cleanup(struct ceph_client *client) debugfs_remove(client->debugfs_monmap); debugfs_remove(client->osdc.debugfs_file); debugfs_remove(client->monc.debugfs_file); - debugfs_remove(client->debugfs_dir); + ceph_debugfs_cleanup_subdir(client->debugfs_dir); } #else /* CONFIG_DEBUG_FS */ @@ -475,4 +487,14 @@ void ceph_debugfs_client_cleanup(struct ceph_client *client) { } +struct dentry *ceph_debugfs_create_subdir(const char *subdir) +{ +} +EXPORT_SYMBOL(ceph_debugfs_create_subdir); + +void ceph_debugfs_cleanup_subdir(struct dentry *subdir_dentry) +{ +} +EXPORT_SYMBOL(ceph_debugfs_cleanup_subdir); + #endif /* CONFIG_DEBUG_FS */ From patchwork Wed Aug 18 06:01:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venky Shankar X-Patchwork-Id: 499051 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4D68C4338F for ; Wed, 18 Aug 2021 06:01:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B6B63608FE for ; Wed, 18 Aug 2021 06:01:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238046AbhHRGC1 (ORCPT ); Wed, 18 Aug 2021 02:02:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:53344 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237998AbhHRGCZ (ORCPT ); Wed, 18 Aug 2021 02:02:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629266511; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XcnZULfvRaZaSxsgM256TjfSITYnqvCQsiXUNryFrYk=; b=CFckpjVp0uqKE5zeNUiHbQnFf9dAxwgBkeUg8JfJnhwPPUv1f+W/RJe5vK2bKt8ifcCCQL b5CaSPuvl8pOSmtZor/QkWRV8/QukvDqU+VqX4P8a9p5R7+ybQ72yICFNRZO2+yd6QLTf+ +XvMWb7FFwfPAY2m4uz//ahYB8CkOXw= Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-141-ojsvZnvcMOCMPgAqiLsjIA-1; Wed, 18 Aug 2021 02:01:49 -0400 X-MC-Unique: ojsvZnvcMOCMPgAqiLsjIA-1 Received: by mail-pj1-f69.google.com with SMTP id t16-20020a17090ae510b0290178bb9f2f04so1049976pjy.1 for ; Tue, 17 Aug 2021 23:01:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XcnZULfvRaZaSxsgM256TjfSITYnqvCQsiXUNryFrYk=; b=uNaWDML/XVpL1uB4BKwRRlrQRECDeDAUBe9u7iqm2b5KSwqW28NGXcC9PyV1WQyhK5 wSZhvY2Q82RHRCZNc9b2G8LBRiz9JwpEve4eJd1vW+KlJ8Wnyt3hRlBlnDLajEPpnGjL ejKodNI98nAGYfDuCuL6s8AgyFQi3WtkgbxFDx65Vq2NOfxMU9RY4zsw5Gqw0mKSGucm HQpOrCaxIy0wsho3tcysXPAfwgbVETiXensaQgNx4nPkSoHreWzMEOmytX9PYsP1zYyW 8dL067lV5cFY3zRjnE1GnYOLShoVvbbvZnYpmQeEG7h+yFQmZqandpT+f1MVfmzF0iQT wyGw== X-Gm-Message-State: AOAM532l17dl8Zx/p1qeL3HG5dE3S0vCiwcnfV2QDfZ1ZMybCzsiGSF8 YcYkauRFZeEI8BRB3gU697cLYa/SqTluwHoOORFouS6PvPPx9dRQJLA9aWAw58KFVAEoMQQIxCH nBzzNDHfLOW5/brAw1FsRjw== X-Received: by 2002:a17:902:bd98:b029:12c:9106:b54f with SMTP id q24-20020a170902bd98b029012c9106b54fmr5881689pls.40.1629266508027; Tue, 17 Aug 2021 23:01:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdV0r+bRcCIFvfEJqs6M8QPTNh3UXBiE8iK0SRbO7O/p5Kct3oN7ILoGjBIL5ZRX5rB0/U9w== X-Received: by 2002:a17:902:bd98:b029:12c:9106:b54f with SMTP id q24-20020a170902bd98b029012c9106b54fmr5881676pls.40.1629266507843; Tue, 17 Aug 2021 23:01:47 -0700 (PDT) Received: from localhost.localdomain ([49.207.198.118]) by smtp.gmail.com with ESMTPSA id m28sm5865111pgl.9.2021.08.17.23.01.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Aug 2021 23:01:47 -0700 (PDT) From: Venky Shankar To: jlayton@redhat.com, pdonnell@redhat.com Cc: ceph-devel@vger.kernel.org, Venky Shankar Subject: [RFC 2/2] ceph: add debugfs entries for v2 (new) mount syntax support Date: Wed, 18 Aug 2021 11:31:34 +0530 Message-Id: <20210818060134.208546-3-vshankar@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210818060134.208546-1-vshankar@redhat.com> References: <20210818060134.208546-1-vshankar@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Signed-off-by: Venky Shankar --- fs/ceph/debugfs.c | 28 ++++++++++++++++++++++++++++ fs/ceph/super.c | 3 +++ fs/ceph/super.h | 2 ++ 3 files changed, 33 insertions(+) diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c index 66989c880adb..d19f15ace781 100644 --- a/fs/ceph/debugfs.c +++ b/fs/ceph/debugfs.c @@ -22,6 +22,12 @@ #include "mds_client.h" #include "metric.h" +#define MNT_DEV_SUPPORT_DIR "dev_support" +#define MNT_DEV_V2_FILE "v2" + +static struct dentry *ceph_mnt_dev_support_dir; +static struct dentry *ceph_mnt_dev_v2_file; + static int mdsmap_show(struct seq_file *s, void *p) { int i; @@ -416,6 +422,20 @@ void ceph_fs_debugfs_init(struct ceph_fs_client *fsc) &status_fops); } +void ceph_fs_debugfs_mnt_dev_init(void) +{ + ceph_mnt_dev_support_dir = ceph_debugfs_create_subdir(MNT_DEV_SUPPORT_DIR); + ceph_mnt_dev_v2_file = debugfs_create_file(MNT_DEV_V2_FILE, + 0400, + ceph_mnt_dev_support_dir, + NULL, NULL); +} + +void ceph_fs_debugfs_mnt_dev_cleanup(void) +{ + debugfs_remove(ceph_mnt_dev_v2_file); + ceph_debugfs_cleanup_subdir(ceph_mnt_dev_support_dir); +} #else /* CONFIG_DEBUG_FS */ @@ -427,4 +447,12 @@ void ceph_fs_debugfs_cleanup(struct ceph_fs_client *fsc) { } +void ceph_fs_debugfs_mnt_dev_init(void) +{ +} + +void ceph_fs_debugfs_mnt_dev_cleanup(void) +{ +} + #endif /* CONFIG_DEBUG_FS */ diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 609ffc8c2d78..21e4a8249afd 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -1404,6 +1404,8 @@ static int __init init_ceph(void) if (ret) goto out_caches; + ceph_fs_debugfs_mnt_dev_init(); + pr_info("loaded (mds proto %d)\n", CEPH_MDSC_PROTOCOL); return 0; @@ -1417,6 +1419,7 @@ static int __init init_ceph(void) static void __exit exit_ceph(void) { dout("exit_ceph\n"); + ceph_fs_debugfs_mnt_dev_cleanup(); unregister_filesystem(&ceph_fs_type); destroy_caches(); } diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 8f71184b7c85..3c63c1adcfaa 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -1231,6 +1231,8 @@ extern int ceph_locks_to_pagelist(struct ceph_filelock *flocks, /* debugfs.c */ extern void ceph_fs_debugfs_init(struct ceph_fs_client *client); extern void ceph_fs_debugfs_cleanup(struct ceph_fs_client *client); +extern void ceph_fs_debugfs_mnt_dev_init(void); +extern void ceph_fs_debugfs_mnt_dev_cleanup(void); /* quota.c */ static inline bool __ceph_has_any_quota(struct ceph_inode_info *ci)