diff mbox series

[v2,2/2] ceph: add debugfs entries for mount syntax support

Message ID 20210825055035.306043-3-vshankar@redhat.com
State New
Headers show
Series ceph: add debugfs entries signifying new mount syntax support | expand

Commit Message

Venky Shankar Aug. 25, 2021, 5:50 a.m. UTC
Signed-off-by: Venky Shankar <vshankar@redhat.com>
---
 fs/ceph/debugfs.c | 36 ++++++++++++++++++++++++++++++++++++
 fs/ceph/super.c   |  3 +++
 fs/ceph/super.h   |  2 ++
 3 files changed, 41 insertions(+)

Comments

Patrick Donnelly Sept. 21, 2021, 2:01 p.m. UTC | #1
On Wed, Aug 25, 2021 at 1:51 AM Venky Shankar <vshankar@redhat.com> wrote:
>

> Signed-off-by: Venky Shankar <vshankar@redhat.com>

> ---

>  fs/ceph/debugfs.c | 36 ++++++++++++++++++++++++++++++++++++

>  fs/ceph/super.c   |  3 +++

>  fs/ceph/super.h   |  2 ++

>  3 files changed, 41 insertions(+)

>

> diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c

> index 66989c880adb..f9ff70704423 100644

> --- a/fs/ceph/debugfs.c

> +++ b/fs/ceph/debugfs.c

> @@ -22,6 +22,14 @@

>  #include "mds_client.h"

>  #include "metric.h"

>

> +#define CLIENT_FEATURES_DIR_NAME   "client_features"

> +#define MOUNT_DEVICE_V1_SUPPORT_FILE_NAME "v1_mount_syntax"

> +#define MOUNT_DEVICE_V2_SUPPORT_FILE_NAME "v2_mount_syntax"

> +

> +static struct dentry *ceph_client_features_dir;

> +static struct dentry *ceph_mount_device_v1_support;

> +static struct dentry *ceph_mount_device_v2_support;

> +

>  static int mdsmap_show(struct seq_file *s, void *p)

>  {

>         int i;

> @@ -416,6 +424,26 @@ void ceph_fs_debugfs_init(struct ceph_fs_client *fsc)

>                                                   &status_fops);

>  }

>

> +void ceph_fs_debugfs_client_features_init(void)

> +{

> +       ceph_client_features_dir = debugfs_create_dir(CLIENT_FEATURES_DIR_NAME,

> +                                                     ceph_debugfs_dir);

> +       ceph_mount_device_v1_support = debugfs_create_file(MOUNT_DEVICE_V1_SUPPORT_FILE_NAME,

> +                                                          0400,

> +                                                          ceph_client_features_dir,

> +                                                          NULL, NULL);

> +       ceph_mount_device_v2_support = debugfs_create_file(MOUNT_DEVICE_V2_SUPPORT_FILE_NAME,

> +                                                          0400,

> +                                                          ceph_client_features_dir,

> +                                                          NULL, NULL);

> +}


Makes sense to me. I can see having separate files for each syntax
type is expedient. If Jeff is cool with this then so am I.

-- 
Patrick Donnelly, Ph.D.
He / Him / His
Principal Software Engineer
Red Hat Sunnyvale, CA
GPG: 19F28A586F808C2402351B93C3301A3E258DD79D
diff mbox series

Patch

diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c
index 66989c880adb..f9ff70704423 100644
--- a/fs/ceph/debugfs.c
+++ b/fs/ceph/debugfs.c
@@ -22,6 +22,14 @@ 
 #include "mds_client.h"
 #include "metric.h"
 
+#define CLIENT_FEATURES_DIR_NAME   "client_features"
+#define MOUNT_DEVICE_V1_SUPPORT_FILE_NAME "v1_mount_syntax"
+#define MOUNT_DEVICE_V2_SUPPORT_FILE_NAME "v2_mount_syntax"
+
+static struct dentry *ceph_client_features_dir;
+static struct dentry *ceph_mount_device_v1_support;
+static struct dentry *ceph_mount_device_v2_support;
+
 static int mdsmap_show(struct seq_file *s, void *p)
 {
 	int i;
@@ -416,6 +424,26 @@  void ceph_fs_debugfs_init(struct ceph_fs_client *fsc)
 						  &status_fops);
 }
 
+void ceph_fs_debugfs_client_features_init(void)
+{
+	ceph_client_features_dir = debugfs_create_dir(CLIENT_FEATURES_DIR_NAME,
+						      ceph_debugfs_dir);
+	ceph_mount_device_v1_support = debugfs_create_file(MOUNT_DEVICE_V1_SUPPORT_FILE_NAME,
+							   0400,
+							   ceph_client_features_dir,
+							   NULL, NULL);
+	ceph_mount_device_v2_support = debugfs_create_file(MOUNT_DEVICE_V2_SUPPORT_FILE_NAME,
+							   0400,
+							   ceph_client_features_dir,
+							   NULL, NULL);
+}
+
+void ceph_fs_debugfs_client_features_cleanup(void)
+{
+	debugfs_remove(ceph_mount_device_v1_support);
+	debugfs_remove(ceph_mount_device_v2_support);
+	debugfs_remove(ceph_client_features_dir);
+}
 
 #else  /* CONFIG_DEBUG_FS */
 
@@ -427,4 +455,12 @@  void ceph_fs_debugfs_cleanup(struct ceph_fs_client *fsc)
 {
 }
 
+void ceph_fs_debugfs_client_features_init(void)
+{
+}
+
+void ceph_fs_debugfs_client_features_cleanup(void)
+{
+}
+
 #endif  /* CONFIG_DEBUG_FS */
diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index 609ffc8c2d78..21d59deb042d 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_client_features_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_client_features_cleanup();
 	unregister_filesystem(&ceph_fs_type);
 	destroy_caches();
 }
diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index 8f71184b7c85..7e7b140cab5d 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_client_features_init(void);
+extern void ceph_fs_debugfs_client_features_cleanup(void);
 
 /* quota.c */
 static inline bool __ceph_has_any_quota(struct ceph_inode_info *ci)