Skip to content

Commit 5cf7bd3

Browse files
committed
libceph: expose client options through debugfs
Add a client_options attribute for showing libceph options. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
1 parent ff40f9a commit 5cf7bd3

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

‎include/linux/ceph/libceph.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ struct ceph_client {
135135
struct dentry *debugfs_dir;
136136
struct dentry *debugfs_monmap;
137137
struct dentry *debugfs_osdmap;
138+
struct dentry *debugfs_options;
138139
#endif
139140
};
140141

‎net/ceph/debugfs.c‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
* .../monmap - current monmap
2323
* .../osdc - active osd requests
2424
* .../monc - mon client state
25+
* .../client_options - libceph-only (i.e. not rbd or cephfs) options
2526
* .../dentry_lru - dump contents of dentry lru
2627
* .../caps - expose cap (reservation) stats
2728
* .../bdi - symlink to ../../bdi/something
@@ -177,10 +178,24 @@ static int osdc_show(struct seq_file *s, void *pp)
177178
return 0;
178179
}
179180

181+
static int client_options_show(struct seq_file *s, void *p)
182+
{
183+
struct ceph_client *client = s->private;
184+
int ret;
185+
186+
ret = ceph_print_client_options(s, client);
187+
if (ret)
188+
return ret;
189+
190+
seq_putc(s, '\n');
191+
return 0;
192+
}
193+
180194
CEPH_DEFINE_SHOW_FUNC(monmap_show)
181195
CEPH_DEFINE_SHOW_FUNC(osdmap_show)
182196
CEPH_DEFINE_SHOW_FUNC(monc_show)
183197
CEPH_DEFINE_SHOW_FUNC(osdc_show)
198+
CEPH_DEFINE_SHOW_FUNC(client_options_show)
184199

185200
int ceph_debugfs_init(void)
186201
{
@@ -242,6 +257,14 @@ int ceph_debugfs_client_init(struct ceph_client *client)
242257
if (!client->debugfs_osdmap)
243258
goto out;
244259

260+
client->debugfs_options = debugfs_create_file("client_options",
261+
0600,
262+
client->debugfs_dir,
263+
client,
264+
&client_options_show_fops);
265+
if (!client->debugfs_options)
266+
goto out;
267+
245268
return 0;
246269

247270
out:
@@ -252,6 +275,7 @@ int ceph_debugfs_client_init(struct ceph_client *client)
252275
void ceph_debugfs_client_cleanup(struct ceph_client *client)
253276
{
254277
dout("ceph_debugfs_client_cleanup %p\n", client);
278+
debugfs_remove(client->debugfs_options);
255279
debugfs_remove(client->debugfs_osdmap);
256280
debugfs_remove(client->debugfs_monmap);
257281
debugfs_remove(client->osdc.debugfs_file);

0 commit comments

Comments
 (0)