Re: [RFC 1/2] ceph: add helpers to create/cleanup debugfs sub-directories under "ceph" directory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There's a build issue with non-debugfs builds -- I'll fix it up and resend.

On Wed, Aug 18, 2021 at 11:31 AM Venky Shankar <vshankar@xxxxxxxxxx> wrote:
>
> 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 <vshankar@xxxxxxxxxx>
> ---
>  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 */
> --
> 2.27.0
>


-- 
Cheers,
Venky




[Index of Archives]     [CEPH Users]     [Ceph Large]     [Ceph Dev]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux