ceph-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Venky Shankar <vshankar@redhat.com>
To: Jeff Layton <jlayton@redhat.com>
Cc: Patrick Donnelly <pdonnell@redhat.com>,
	ceph-devel <ceph-devel@vger.kernel.org>
Subject: Re: [PATCH 1/2] ceph: add helpers to create/cleanup debugfs sub-directories under "ceph" directory
Date: Mon, 23 Aug 2021 10:25:35 +0530	[thread overview]
Message-ID: <CACPzV1nDJq46_rai7wYpZqXB2UDmcxo9tfjwfrVPio6ZU0uWYw@mail.gmail.com> (raw)
In-Reply-To: <9891128997ecdd7a2b9c88b3a7271936f5d66fd7.camel@redhat.com>

On Thu, Aug 19, 2021 at 10:46 PM Jeff Layton <jlayton@redhat.com> wrote:
>
> On Thu, 2021-08-19 at 11:37 +0530, Venky Shankar 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@redhat.com>
> > ---
> >  include/linux/ceph/debugfs.h |  3 +++
> >  net/ceph/debugfs.c           | 27 +++++++++++++++++++++++++--
> >  2 files changed, 28 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..cd6f69dd97fa 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);
> > +
>
> Rather than these specialized helpers, I think it'd be cleaner/more
> evident to just export the ceph_debugfs_dir symbol and then use normal
> debugfs commands in ceph.ko.

I had initially thought of doing that, but was concerned about putting
ceph_debugfs_dir to abuse once exported.

>
> >  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,15 @@ void ceph_debugfs_client_cleanup(struct ceph_client *client)
> >  {
> >  }
> >
> > +struct dentry *ceph_debugfs_create_subdir(const char *subdir)
> > +{
> > +     return NULL;
> > +}
> > +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 */
>
> --
> Jeff Layton <jlayton@redhat.com>
>


-- 
Cheers,
Venky


  reply	other threads:[~2021-08-23  4:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-19  6:06 [PATCH 0/2] ceph: add debugfs entries signifying new mount syntax support Venky Shankar
2021-08-19  6:07 ` [PATCH 1/2] ceph: add helpers to create/cleanup debugfs sub-directories under "ceph" directory Venky Shankar
2021-08-19 17:16   ` Jeff Layton
2021-08-23  4:55     ` Venky Shankar [this message]
2021-08-23 10:30       ` Jeff Layton
2021-08-19  6:07 ` [PATCH 2/2] ceph: add debugfs entries for v2 (new) mount syntax support Venky Shankar
2021-08-19 17:28 ` [PATCH 0/2] ceph: add debugfs entries signifying new " Jeff Layton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACPzV1nDJq46_rai7wYpZqXB2UDmcxo9tfjwfrVPio6ZU0uWYw@mail.gmail.com \
    --to=vshankar@redhat.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=jlayton@redhat.com \
    --cc=pdonnell@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).