diff mbox series

[1/2] ceph: add status debug file support

Message ID 20201105023703.735882-2-xiubli@redhat.com
State New
Headers show
Series ceph: add _IDS ioctl cmd and status debug file support | expand

Commit Message

Xiubo Li Nov. 5, 2020, 2:37 a.m. UTC
From: Xiubo Li <xiubli@redhat.com>

This will help list some useful client side info, like the client
entity address/name and bloclisted status, etc.

URL: https://tracker.ceph.com/issues/48057
Signed-off-by: Xiubo Li <xiubli@redhat.com>
---
 fs/ceph/debugfs.c | 22 ++++++++++++++++++++++
 fs/ceph/super.h   |  1 +
 2 files changed, 23 insertions(+)

Comments

Ilya Dryomov Nov. 10, 2020, 7:51 a.m. UTC | #1
On Thu, Nov 5, 2020 at 3:37 AM <xiubli@redhat.com> wrote:
>

> From: Xiubo Li <xiubli@redhat.com>

>

> This will help list some useful client side info, like the client

> entity address/name and bloclisted status, etc.

>

> URL: https://tracker.ceph.com/issues/48057

> Signed-off-by: Xiubo Li <xiubli@redhat.com>

> ---

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

>  fs/ceph/super.h   |  1 +

>  2 files changed, 23 insertions(+)

>

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

> index 7a8fbe3e4751..8b6db73c94ad 100644

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

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

> @@ -14,6 +14,7 @@

>  #include <linux/ceph/mon_client.h>

>  #include <linux/ceph/auth.h>

>  #include <linux/ceph/debugfs.h>

> +#include <linux/ceph/messenger.h>

>

>  #include "super.h"

>

> @@ -127,6 +128,20 @@ static int mdsc_show(struct seq_file *s, void *p)

>         return 0;

>  }

>

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

> +{

> +       struct ceph_fs_client *fsc = s->private;

> +       struct ceph_messenger *msgr = &fsc->client->msgr;

> +       struct ceph_entity_inst *inst = &msgr->inst;

> +

> +       seq_printf(s, "status:\n\n"),


Hi Xiubo,

This header and leading tabs seem rather useless to me.

> +       seq_printf(s, "\tinst_str:\t%s.%lld  %s/%u\n", ENTITY_NAME(inst->name),


                                             ^^ two spaces?

> +                  ceph_pr_addr(&inst->addr), le32_to_cpu(inst->addr.nonce));

> +       seq_printf(s, "\tblocklisted:\t%s\n", fsc->blocklisted ? "true" : "false");


This line is too long.

Thanks,

                Ilya
Xiubo Li Nov. 10, 2020, 8:03 a.m. UTC | #2
On 2020/11/10 15:51, Ilya Dryomov wrote:
> On Thu, Nov 5, 2020 at 3:37 AM <xiubli@redhat.com> wrote:

>> From: Xiubo Li <xiubli@redhat.com>

>>

>> This will help list some useful client side info, like the client

>> entity address/name and bloclisted status, etc.

>>

>> URL: https://tracker.ceph.com/issues/48057

>> Signed-off-by: Xiubo Li <xiubli@redhat.com>

>> ---

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

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

>>   2 files changed, 23 insertions(+)

>>

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

>> index 7a8fbe3e4751..8b6db73c94ad 100644

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

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

>> @@ -14,6 +14,7 @@

>>   #include <linux/ceph/mon_client.h>

>>   #include <linux/ceph/auth.h>

>>   #include <linux/ceph/debugfs.h>

>> +#include <linux/ceph/messenger.h>

>>

>>   #include "super.h"

>>

>> @@ -127,6 +128,20 @@ static int mdsc_show(struct seq_file *s, void *p)

>>          return 0;

>>   }

>>

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

>> +{

>> +       struct ceph_fs_client *fsc = s->private;

>> +       struct ceph_messenger *msgr = &fsc->client->msgr;

>> +       struct ceph_entity_inst *inst = &msgr->inst;

>> +

>> +       seq_printf(s, "status:\n\n"),

> Hi Xiubo,

>

> This header and leading tabs seem rather useless to me.


Sure, will remove them.


>> +       seq_printf(s, "\tinst_str:\t%s.%lld  %s/%u\n", ENTITY_NAME(inst->name),

>                                               ^^ two spaces?

>

>> +                  ceph_pr_addr(&inst->addr), le32_to_cpu(inst->addr.nonce));

>> +       seq_printf(s, "\tblocklisted:\t%s\n", fsc->blocklisted ? "true" : "false");

> This line is too long.


Will fix it.

Thank Ilya.


> Thanks,

>

>                  Ilya

>
diff mbox series

Patch

diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c
index 7a8fbe3e4751..8b6db73c94ad 100644
--- a/fs/ceph/debugfs.c
+++ b/fs/ceph/debugfs.c
@@ -14,6 +14,7 @@ 
 #include <linux/ceph/mon_client.h>
 #include <linux/ceph/auth.h>
 #include <linux/ceph/debugfs.h>
+#include <linux/ceph/messenger.h>
 
 #include "super.h"
 
@@ -127,6 +128,20 @@  static int mdsc_show(struct seq_file *s, void *p)
 	return 0;
 }
 
+static int status_show(struct seq_file *s, void *p)
+{
+	struct ceph_fs_client *fsc = s->private;
+	struct ceph_messenger *msgr = &fsc->client->msgr;
+	struct ceph_entity_inst *inst = &msgr->inst;
+
+	seq_printf(s, "status:\n\n"),
+	seq_printf(s, "\tinst_str:\t%s.%lld  %s/%u\n", ENTITY_NAME(inst->name),
+		   ceph_pr_addr(&inst->addr), le32_to_cpu(inst->addr.nonce));
+	seq_printf(s, "\tblocklisted:\t%s\n", fsc->blocklisted ? "true" : "false");
+
+	return 0;
+}
+
 #define CEPH_METRIC_SHOW(name, total, avg, min, max, sq) {		\
 	s64 _total, _avg, _min, _max, _sq, _st;				\
 	_avg = ktime_to_us(avg);					\
@@ -309,6 +324,7 @@  DEFINE_SHOW_ATTRIBUTE(mdsc);
 DEFINE_SHOW_ATTRIBUTE(caps);
 DEFINE_SHOW_ATTRIBUTE(mds_sessions);
 DEFINE_SHOW_ATTRIBUTE(metric);
+DEFINE_SHOW_ATTRIBUTE(status);
 
 
 /*
@@ -394,6 +410,12 @@  void ceph_fs_debugfs_init(struct ceph_fs_client *fsc)
 						fsc->client->debugfs_dir,
 						fsc,
 						&caps_fops);
+
+	fsc->debugfs_status = debugfs_create_file("status",
+						  0400,
+						  fsc->client->debugfs_dir,
+						  fsc,
+						  &status_fops);
 }
 
 
diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index f097237a5ad3..5138b75923f9 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -128,6 +128,7 @@  struct ceph_fs_client {
 	struct dentry *debugfs_bdi;
 	struct dentry *debugfs_mdsc, *debugfs_mdsmap;
 	struct dentry *debugfs_metric;
+	struct dentry *debugfs_status;
 	struct dentry *debugfs_mds_sessions;
 #endif