@@ -133,6 +133,7 @@ struct ceph_client {
struct dentry *debugfs_monmap;
struct dentry *debugfs_osdmap;
struct dentry *debugfs_options;
+ struct dentry *debugfs_options_all;
#endif
};
@@ -274,7 +275,7 @@ extern struct ceph_options *ceph_parse_options(char *options,
const char *dev_name, const char *dev_name_end,
int (*parse_extra_token)(char *c, void *private),
void *private);
-int ceph_print_client_options(struct seq_file *m, struct ceph_client *client);
+int ceph_print_client_options(struct seq_file *m, struct ceph_client *client, bool skip_default);
extern void ceph_destroy_options(struct ceph_options *opt);
extern int ceph_compare_options(struct ceph_options *new_opt,
struct ceph_client *client);
@@ -544,7 +544,7 @@ struct ceph_options *
}
EXPORT_SYMBOL(ceph_parse_options);
-int ceph_print_client_options(struct seq_file *m, struct ceph_client *client)
+int ceph_print_client_options(struct seq_file *m, struct ceph_client *client, bool skip_default)
{
struct ceph_options *opt = client->options;
size_t pos = m->count;
@@ -570,16 +570,16 @@ int ceph_print_client_options(struct seq_file *m, struct ceph_client *client)
if ((opt->flags & CEPH_OPT_TCP_NODELAY) == 0)
seq_puts(m, "notcp_nodelay,");
- if (opt->mount_timeout != CEPH_MOUNT_TIMEOUT_DEFAULT)
+ if (opt->mount_timeout != CEPH_MOUNT_TIMEOUT_DEFAULT || !skip_default)
seq_printf(m, "mount_timeout=%d,",
jiffies_to_msecs(opt->mount_timeout) / 1000);
- if (opt->osd_idle_ttl != CEPH_OSD_IDLE_TTL_DEFAULT)
+ if (opt->osd_idle_ttl != CEPH_OSD_IDLE_TTL_DEFAULT || !skip_default)
seq_printf(m, "osd_idle_ttl=%d,",
jiffies_to_msecs(opt->osd_idle_ttl) / 1000);
- if (opt->osd_keepalive_timeout != CEPH_OSD_KEEPALIVE_DEFAULT)
+ if (opt->osd_keepalive_timeout != CEPH_OSD_KEEPALIVE_DEFAULT || !skip_default)
seq_printf(m, "osdkeepalivetimeout=%d,",
jiffies_to_msecs(opt->osd_keepalive_timeout) / 1000);
- if (opt->osd_request_timeout != CEPH_OSD_REQUEST_TIMEOUT_DEFAULT)
+ if (opt->osd_request_timeout != CEPH_OSD_REQUEST_TIMEOUT_DEFAULT || !skip_default)
seq_printf(m, "osd_request_timeout=%d,",
jiffies_to_msecs(opt->osd_request_timeout) / 1000);
@@ -375,7 +375,20 @@ static int client_options_show(struct seq_file *s, void *p)
struct ceph_client *client = s->private;
int ret;
- ret = ceph_print_client_options(s, client);
+ ret = ceph_print_client_options(s, client, true);
+ if (ret)
+ return ret;
+
+ seq_putc(s, '\n');
+ return 0;
+}
+
+static int client_options_all_show(struct seq_file *s, void *p)
+{
+ struct ceph_client *client = s->private;
+ int ret;
+
+ ret = ceph_print_client_options(s, client, false);
if (ret)
return ret;
@@ -388,6 +401,7 @@ static int client_options_show(struct seq_file *s, void *p)
CEPH_DEFINE_SHOW_FUNC(monc_show)
CEPH_DEFINE_SHOW_FUNC(osdc_show)
CEPH_DEFINE_SHOW_FUNC(client_options_show)
+CEPH_DEFINE_SHOW_FUNC(client_options_all_show)
int ceph_debugfs_init(void)
{
@@ -457,6 +471,14 @@ int ceph_debugfs_client_init(struct ceph_client *client)
if (!client->debugfs_options)
goto out;
+ client->debugfs_options_all = debugfs_create_file("client_options_all",
+ 0600,
+ client->debugfs_dir,
+ client,
+ &client_options_all_show_fops);
+ if (!client->debugfs_options_all)
+ goto out;
+
return 0;
out:
@@ -467,6 +489,7 @@ int ceph_debugfs_client_init(struct ceph_client *client)
void ceph_debugfs_client_cleanup(struct ceph_client *client)
{
dout("ceph_debugfs_client_cleanup %p\n", client);
+ debugfs_remove(client->debugfs_options_all);
debugfs_remove(client->debugfs_options);
debugfs_remove(client->debugfs_osdmap);
debugfs_remove(client->debugfs_monmap);
As the /sys/kernel/debug/ceph/XXX/client_options only print options which is different with default values, user are not able to know the default values of them. So we need to show the all options for user, but we can't change the client_options file for backward compatibility, then this patch add a new file in debugfs client_options_all to show the all options for user. Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn> --- include/linux/ceph/libceph.h | 3 ++- net/ceph/ceph_common.c | 10 +++++----- net/ceph/debugfs.c | 25 ++++++++++++++++++++++++- 3 files changed, 31 insertions(+), 7 deletions(-)