Blame view

net/ceph/debugfs.c 12.3 KB
b24413180   Greg Kroah-Hartman   License cleanup: ...
1
  // SPDX-License-Identifier: GPL-2.0
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  #include <linux/ceph/ceph_debug.h>
  
  #include <linux/device.h>
  #include <linux/slab.h>
  #include <linux/module.h>
  #include <linux/ctype.h>
  #include <linux/debugfs.h>
  #include <linux/seq_file.h>
  
  #include <linux/ceph/libceph.h>
  #include <linux/ceph/mon_client.h>
  #include <linux/ceph/auth.h>
  #include <linux/ceph/debugfs.h>
  
  #ifdef CONFIG_DEBUG_FS
  
  /*
   * Implement /sys/kernel/debug/ceph fun
   *
   * /sys/kernel/debug/ceph/client*  - an instance of the ceph client
   *      .../osdmap      - current osdmap
   *      .../monmap      - current monmap
   *      .../osdc        - active osd requests
   *      .../monc        - mon client state
5cf7bd301   Ilya Dryomov   libceph: expose c...
26
   *      .../client_options - libceph-only (i.e. not rbd or cephfs) options
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
   *      .../dentry_lru  - dump contents of dentry lru
   *      .../caps        - expose cap (reservation) stats
   *      .../bdi         - symlink to ../../bdi/something
   */
  
  static struct dentry *ceph_debugfs_dir;
  
  static int monmap_show(struct seq_file *s, void *p)
  {
  	int i;
  	struct ceph_client *client = s->private;
  
  	if (client->monc.monmap == NULL)
  		return 0;
  
  	seq_printf(s, "epoch %d
  ", client->monc.monmap->epoch);
  	for (i = 0; i < client->monc.monmap->num_mon; i++) {
  		struct ceph_entity_inst *inst =
  			&client->monc.monmap->mon_inst[i];
  
  		seq_printf(s, "\t%s%lld\t%s
  ",
  			   ENTITY_NAME(inst->name),
b726ec972   Jeff Layton   libceph: make cep...
51
  			   ceph_pr_addr(&inst->addr));
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
52
53
54
55
56
57
58
59
  	}
  	return 0;
  }
  
  static int osdmap_show(struct seq_file *s, void *p)
  {
  	int i;
  	struct ceph_client *client = s->private;
b4f347956   Ilya Dryomov   libceph: take osd...
60
61
  	struct ceph_osd_client *osdc = &client->osdc;
  	struct ceph_osdmap *map = osdc->osdmap;
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
62
  	struct rb_node *n;
35fea3a18   Ilya Dryomov   libceph: refer to...
63
  	if (map == NULL)
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
64
  		return 0;
35fea3a18   Ilya Dryomov   libceph: refer to...
65

b4f347956   Ilya Dryomov   libceph: take osd...
66
  	down_read(&osdc->lock);
58eb7932a   Jeff Layton   libceph: add an e...
67
68
69
  	seq_printf(s, "epoch %u barrier %u flags 0x%x
  ", map->epoch,
  			osdc->epoch_barrier, map->flags);
35fea3a18   Ilya Dryomov   libceph: refer to...
70
71
  
  	for (n = rb_first(&map->pg_pools); n; n = rb_next(n)) {
04812acf5   Ilya Dryomov   libceph: pi->min_...
72
  		struct ceph_pg_pool_info *pi =
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
73
  			rb_entry(n, struct ceph_pg_pool_info, node);
35fea3a18   Ilya Dryomov   libceph: refer to...
74

04812acf5   Ilya Dryomov   libceph: pi->min_...
75
76
77
78
79
80
  		seq_printf(s, "pool %lld '%s' type %d size %d min_size %d pg_num %u pg_num_mask %d flags 0x%llx lfor %u read_tier %lld write_tier %lld
  ",
  			   pi->id, pi->name, pi->type, pi->size, pi->min_size,
  			   pi->pg_num, pi->pg_num_mask, pi->flags,
  			   pi->last_force_request_resend, pi->read_tier,
  			   pi->write_tier);
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
81
  	}
35fea3a18   Ilya Dryomov   libceph: refer to...
82
83
  	for (i = 0; i < map->max_osd; i++) {
  		struct ceph_entity_addr *addr = &map->osd_addr[i];
0bb05da2e   Ilya Dryomov   libceph: osd_stat...
84
  		u32 state = map->osd_state[i];
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
85
  		char sb[64];
117d96a04   Ilya Dryomov   libceph: support ...
86
87
  		seq_printf(s, "osd%d\t%s\t%3d%%\t(%s)\t%3d%%\t%2d
  ",
b726ec972   Jeff Layton   libceph: make cep...
88
  			   i, ceph_pr_addr(addr),
35fea3a18   Ilya Dryomov   libceph: refer to...
89
  			   ((map->osd_weight[i]*100) >> 16),
2cfa34f2d   Ilya Dryomov   libceph: primary_...
90
  			   ceph_osdmap_state_str(sb, sizeof(sb), state),
117d96a04   Ilya Dryomov   libceph: support ...
91
92
93
  			   ((ceph_get_primary_affinity(map, i)*100) >> 16),
  			   ceph_get_crush_locality(map, i,
  					   &client->options->crush_locs));
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
94
  	}
1c00240e0   Ilya Dryomov   libceph: dump pg_...
95
96
97
98
99
100
  	for (n = rb_first(&map->pg_temp); n; n = rb_next(n)) {
  		struct ceph_pg_mapping *pg =
  			rb_entry(n, struct ceph_pg_mapping, node);
  
  		seq_printf(s, "pg_temp %llu.%x [", pg->pgid.pool,
  			   pg->pgid.seed);
35a935d75   Ilya Dryomov   libceph: generali...
101
  		for (i = 0; i < pg->pg_temp.len; i++)
1c00240e0   Ilya Dryomov   libceph: dump pg_...
102
  			seq_printf(s, "%s%d", (i == 0 ? "" : ","),
35a935d75   Ilya Dryomov   libceph: generali...
103
  				   pg->pg_temp.osds[i]);
1c00240e0   Ilya Dryomov   libceph: dump pg_...
104
105
106
  		seq_printf(s, "]
  ");
  	}
9686f94c8   Ilya Dryomov   libceph: primary_...
107
108
109
110
111
112
113
114
  	for (n = rb_first(&map->primary_temp); n; n = rb_next(n)) {
  		struct ceph_pg_mapping *pg =
  			rb_entry(n, struct ceph_pg_mapping, node);
  
  		seq_printf(s, "primary_temp %llu.%x %d
  ", pg->pgid.pool,
  			   pg->pgid.seed, pg->primary_temp.osd);
  	}
6f428df47   Ilya Dryomov   libceph: pg_upmap...
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
  	for (n = rb_first(&map->pg_upmap); n; n = rb_next(n)) {
  		struct ceph_pg_mapping *pg =
  			rb_entry(n, struct ceph_pg_mapping, node);
  
  		seq_printf(s, "pg_upmap %llu.%x [", pg->pgid.pool,
  			   pg->pgid.seed);
  		for (i = 0; i < pg->pg_upmap.len; i++)
  			seq_printf(s, "%s%d", (i == 0 ? "" : ","),
  				   pg->pg_upmap.osds[i]);
  		seq_printf(s, "]
  ");
  	}
  	for (n = rb_first(&map->pg_upmap_items); n; n = rb_next(n)) {
  		struct ceph_pg_mapping *pg =
  			rb_entry(n, struct ceph_pg_mapping, node);
  
  		seq_printf(s, "pg_upmap_items %llu.%x [", pg->pgid.pool,
  			   pg->pgid.seed);
  		for (i = 0; i < pg->pg_upmap_items.len; i++)
  			seq_printf(s, "%s%d->%d", (i == 0 ? "" : ","),
  				   pg->pg_upmap_items.from_to[i][0],
  				   pg->pg_upmap_items.from_to[i][1]);
  		seq_printf(s, "]
  ");
  	}
35fea3a18   Ilya Dryomov   libceph: refer to...
140

b4f347956   Ilya Dryomov   libceph: take osd...
141
  	up_read(&osdc->lock);
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
142
143
144
145
146
147
148
149
150
  	return 0;
  }
  
  static int monc_show(struct seq_file *s, void *p)
  {
  	struct ceph_client *client = s->private;
  	struct ceph_mon_generic_request *req;
  	struct ceph_mon_client *monc = &client->monc;
  	struct rb_node *rp;
82dcabad7   Ilya Dryomov   libceph: revamp s...
151
  	int i;
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
152
153
  
  	mutex_lock(&monc->mutex);
82dcabad7   Ilya Dryomov   libceph: revamp s...
154
155
156
157
158
159
160
161
162
163
164
  	for (i = 0; i < ARRAY_SIZE(monc->subs); i++) {
  		seq_printf(s, "have %s %u", ceph_sub_str[i],
  			   monc->subs[i].have);
  		if (monc->subs[i].want)
  			seq_printf(s, " want %llu%s",
  				   le64_to_cpu(monc->subs[i].item.start),
  				   (monc->subs[i].item.flags &
  					CEPH_SUBSCRIBE_ONETIME ?  "" : "+"));
  		seq_putc(s, '
  ');
  	}
737cc81ea   Ilya Dryomov   libceph: support ...
165
166
  	seq_printf(s, "fs_cluster_id %d
  ", monc->fs_cluster_id);
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
167
168
169
170
171
172
  
  	for (rp = rb_first(&monc->generic_request_tree); rp; rp = rb_next(rp)) {
  		__u16 op;
  		req = rb_entry(rp, struct ceph_mon_generic_request, node);
  		op = le16_to_cpu(req->request->hdr.type);
  		if (op == CEPH_MSG_STATFS)
002b36ba5   Ilya Dryomov   libceph: recogniz...
173
174
  			seq_printf(s, "%llu statfs
  ", req->tid);
513a8243d   Ilya Dryomov   libceph: mon_get_...
175
176
  		else if (op == CEPH_MSG_MON_GET_VERSION)
  			seq_printf(s, "%llu mon_get_version", req->tid);
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
177
  		else
002b36ba5   Ilya Dryomov   libceph: recogniz...
178
179
  			seq_printf(s, "%llu unknown
  ", req->tid);
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
180
181
182
183
184
  	}
  
  	mutex_unlock(&monc->mutex);
  	return 0;
  }
dc98ff723   Ilya Dryomov   libceph: introduc...
185
186
187
188
189
190
  static void dump_spgid(struct seq_file *s, const struct ceph_spg *spgid)
  {
  	seq_printf(s, "%llu.%x", spgid->pgid.pool, spgid->pgid.seed);
  	if (spgid->shard != CEPH_SPG_NOSHARD)
  		seq_printf(s, "s%d", spgid->shard);
  }
bb873b539   Ilya Dryomov   libceph: switch t...
191
192
193
  static void dump_target(struct seq_file *s, struct ceph_osd_request_target *t)
  {
  	int i;
dc98ff723   Ilya Dryomov   libceph: introduc...
194
195
196
  	seq_printf(s, "osd%d\t%llu.%x\t", t->osd, t->pgid.pool, t->pgid.seed);
  	dump_spgid(s, &t->spgid);
  	seq_puts(s, "\t[");
bb873b539   Ilya Dryomov   libceph: switch t...
197
198
199
200
201
  	for (i = 0; i < t->up.size; i++)
  		seq_printf(s, "%s%d", (!i ? "" : ","), t->up.osds[i]);
  	seq_printf(s, "]/%d\t[", t->up.primary);
  	for (i = 0; i < t->acting.size; i++)
  		seq_printf(s, "%s%d", (!i ? "" : ","), t->acting.osds[i]);
04c7d789e   Ilya Dryomov   libceph: make sur...
202
  	seq_printf(s, "]/%d\te%u\t", t->acting.primary, t->epoch);
30c156d99   Yan, Zheng   libceph: rados po...
203
204
205
206
207
208
209
210
211
  	if (t->target_oloc.pool_ns) {
  		seq_printf(s, "%*pE/%*pE\t0x%x",
  			(int)t->target_oloc.pool_ns->len,
  			t->target_oloc.pool_ns->str,
  			t->target_oid.name_len, t->target_oid.name, t->flags);
  	} else {
  		seq_printf(s, "%*pE\t0x%x", t->target_oid.name_len,
  			t->target_oid.name, t->flags);
  	}
bb873b539   Ilya Dryomov   libceph: switch t...
212
213
214
215
216
217
218
219
220
221
  	if (t->paused)
  		seq_puts(s, "\tP");
  }
  
  static void dump_request(struct seq_file *s, struct ceph_osd_request *req)
  {
  	int i;
  
  	seq_printf(s, "%llu\t", req->r_tid);
  	dump_target(s, &req->r_t);
aa26d662b   Jeff Layton   libceph: remove r...
222
  	seq_printf(s, "\t%d", req->r_attempts);
bb873b539   Ilya Dryomov   libceph: switch t...
223
224
225
226
227
228
  
  	for (i = 0; i < req->r_num_ops; i++) {
  		struct ceph_osd_req_op *op = &req->r_ops[i];
  
  		seq_printf(s, "%s%s", (i == 0 ? "\t" : ","),
  			   ceph_osd_op_name(op->op));
922dab613   Ilya Dryomov   libceph, rbd: cep...
229
230
231
  		if (op->op == CEPH_OSD_OP_WATCH)
  			seq_printf(s, "-%s",
  				   ceph_osd_watch_op_name(op->watch.op));
6e6f0f011   Ilya Dryomov   libceph: dump cla...
232
233
234
  		else if (op->op == CEPH_OSD_OP_CALL)
  			seq_printf(s, "-%s/%s", op->cls.class_name,
  				   op->cls.method_name);
bb873b539   Ilya Dryomov   libceph: switch t...
235
236
237
238
239
  	}
  
  	seq_putc(s, '
  ');
  }
5aea3dcd5   Ilya Dryomov   libceph: a major ...
240
241
242
243
244
245
246
247
248
249
250
251
252
253
  static void dump_requests(struct seq_file *s, struct ceph_osd *osd)
  {
  	struct rb_node *n;
  
  	mutex_lock(&osd->lock);
  	for (n = rb_first(&osd->o_requests); n; n = rb_next(n)) {
  		struct ceph_osd_request *req =
  		    rb_entry(n, struct ceph_osd_request, r_node);
  
  		dump_request(s, req);
  	}
  
  	mutex_unlock(&osd->lock);
  }
922dab613   Ilya Dryomov   libceph, rbd: cep...
254
255
256
257
258
  static void dump_linger_request(struct seq_file *s,
  				struct ceph_osd_linger_request *lreq)
  {
  	seq_printf(s, "%llu\t", lreq->linger_id);
  	dump_target(s, &lreq->t);
190792032   Ilya Dryomov   libceph: support ...
259
260
261
262
  	seq_printf(s, "\t%u\t%s%s/%d
  ", lreq->register_gen,
  		   lreq->is_watch ? "W" : "N", lreq->committed ? "C" : "",
  		   lreq->last_error);
922dab613   Ilya Dryomov   libceph, rbd: cep...
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
  }
  
  static void dump_linger_requests(struct seq_file *s, struct ceph_osd *osd)
  {
  	struct rb_node *n;
  
  	mutex_lock(&osd->lock);
  	for (n = rb_first(&osd->o_linger_requests); n; n = rb_next(n)) {
  		struct ceph_osd_linger_request *lreq =
  		    rb_entry(n, struct ceph_osd_linger_request, node);
  
  		dump_linger_request(s, lreq);
  	}
  
  	mutex_unlock(&osd->lock);
  }
a02a946df   Ilya Dryomov   libceph: respect ...
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
  static void dump_snapid(struct seq_file *s, u64 snapid)
  {
  	if (snapid == CEPH_NOSNAP)
  		seq_puts(s, "head");
  	else if (snapid == CEPH_SNAPDIR)
  		seq_puts(s, "snapdir");
  	else
  		seq_printf(s, "%llx", snapid);
  }
  
  static void dump_name_escaped(struct seq_file *s, unsigned char *name,
  			      size_t len)
  {
  	size_t i;
  
  	for (i = 0; i < len; i++) {
  		if (name[i] == '%' || name[i] == ':' || name[i] == '/' ||
  		    name[i] < 32 || name[i] >= 127) {
  			seq_printf(s, "%%%02x", name[i]);
  		} else {
  			seq_putc(s, name[i]);
  		}
  	}
  }
  
  static void dump_hoid(struct seq_file *s, const struct ceph_hobject_id *hoid)
  {
  	if (hoid->snapid == 0 && hoid->hash == 0 && !hoid->is_max &&
  	    hoid->pool == S64_MIN) {
  		seq_puts(s, "MIN");
  		return;
  	}
  	if (hoid->is_max) {
  		seq_puts(s, "MAX");
  		return;
  	}
  	seq_printf(s, "%lld:%08x:", hoid->pool, hoid->hash_reverse_bits);
  	dump_name_escaped(s, hoid->nspace, hoid->nspace_len);
  	seq_putc(s, ':');
  	dump_name_escaped(s, hoid->key, hoid->key_len);
  	seq_putc(s, ':');
  	dump_name_escaped(s, hoid->oid, hoid->oid_len);
  	seq_putc(s, ':');
  	dump_snapid(s, hoid->snapid);
  }
  
  static void dump_backoffs(struct seq_file *s, struct ceph_osd *osd)
  {
  	struct rb_node *n;
  
  	mutex_lock(&osd->lock);
  	for (n = rb_first(&osd->o_backoffs_by_id); n; n = rb_next(n)) {
  		struct ceph_osd_backoff *backoff =
  		    rb_entry(n, struct ceph_osd_backoff, id_node);
  
  		seq_printf(s, "osd%d\t", osd->o_osd);
  		dump_spgid(s, &backoff->spgid);
  		seq_printf(s, "\t%llu\t", backoff->id);
  		dump_hoid(s, backoff->begin);
  		seq_putc(s, '\t');
  		dump_hoid(s, backoff->end);
  		seq_putc(s, '
  ');
  	}
  
  	mutex_unlock(&osd->lock);
  }
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
346
347
348
349
  static int osdc_show(struct seq_file *s, void *pp)
  {
  	struct ceph_client *client = s->private;
  	struct ceph_osd_client *osdc = &client->osdc;
5aea3dcd5   Ilya Dryomov   libceph: a major ...
350
  	struct rb_node *n;
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
351

5aea3dcd5   Ilya Dryomov   libceph: a major ...
352
353
354
355
356
357
358
  	down_read(&osdc->lock);
  	seq_printf(s, "REQUESTS %d homeless %d
  ",
  		   atomic_read(&osdc->num_requests),
  		   atomic_read(&osdc->num_homeless));
  	for (n = rb_first(&osdc->osds); n; n = rb_next(n)) {
  		struct ceph_osd *osd = rb_entry(n, struct ceph_osd, o_node);
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
359

5aea3dcd5   Ilya Dryomov   libceph: a major ...
360
  		dump_requests(s, osd);
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
361
  	}
5aea3dcd5   Ilya Dryomov   libceph: a major ...
362
  	dump_requests(s, &osdc->homeless_osd);
922dab613   Ilya Dryomov   libceph, rbd: cep...
363
364
365
366
367
368
369
370
  	seq_puts(s, "LINGER REQUESTS
  ");
  	for (n = rb_first(&osdc->osds); n; n = rb_next(n)) {
  		struct ceph_osd *osd = rb_entry(n, struct ceph_osd, o_node);
  
  		dump_linger_requests(s, osd);
  	}
  	dump_linger_requests(s, &osdc->homeless_osd);
a02a946df   Ilya Dryomov   libceph: respect ...
371
372
373
374
375
376
377
  	seq_puts(s, "BACKOFFS
  ");
  	for (n = rb_first(&osdc->osds); n; n = rb_next(n)) {
  		struct ceph_osd *osd = rb_entry(n, struct ceph_osd, o_node);
  
  		dump_backoffs(s, osd);
  	}
5aea3dcd5   Ilya Dryomov   libceph: a major ...
378
  	up_read(&osdc->lock);
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
379
380
  	return 0;
  }
5cf7bd301   Ilya Dryomov   libceph: expose c...
381
382
383
384
  static int client_options_show(struct seq_file *s, void *p)
  {
  	struct ceph_client *client = s->private;
  	int ret;
02b2f549d   Dongsheng Yang   libceph: allow se...
385
  	ret = ceph_print_client_options(s, client, true);
5cf7bd301   Ilya Dryomov   libceph: expose c...
386
387
388
389
390
391
392
  	if (ret)
  		return ret;
  
  	seq_putc(s, '
  ');
  	return 0;
  }
072eaf3c0   Ilya Dryomov   libceph: drop CEP...
393
394
395
396
397
  DEFINE_SHOW_ATTRIBUTE(monmap);
  DEFINE_SHOW_ATTRIBUTE(osdmap);
  DEFINE_SHOW_ATTRIBUTE(monc);
  DEFINE_SHOW_ATTRIBUTE(osdc);
  DEFINE_SHOW_ATTRIBUTE(client_options);
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
398

1a829ff2a   Greg Kroah-Hartman   ceph: no need to ...
399
  void __init ceph_debugfs_init(void)
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
400
401
  {
  	ceph_debugfs_dir = debugfs_create_dir("ceph", NULL);
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
402
403
404
405
406
407
  }
  
  void ceph_debugfs_cleanup(void)
  {
  	debugfs_remove(ceph_debugfs_dir);
  }
1a829ff2a   Greg Kroah-Hartman   ceph: no need to ...
408
  void ceph_debugfs_client_init(struct ceph_client *client)
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
409
  {
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
410
411
412
413
  	char name[80];
  
  	snprintf(name, sizeof(name), "%pU.client%lld", &client->fsid,
  		 client->monc.auth->global_id);
d1c338a50   Sage Weil   libceph: delay de...
414
415
  	dout("ceph_debugfs_client_init %p %s
  ", client, name);
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
416
  	client->debugfs_dir = debugfs_create_dir(name, ceph_debugfs_dir);
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
417
418
  
  	client->monc.debugfs_file = debugfs_create_file("monc",
11e1478df   Chengguang Xu   libceph, ceph: ch...
419
  						      0400,
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
420
421
  						      client->debugfs_dir,
  						      client,
072eaf3c0   Ilya Dryomov   libceph: drop CEP...
422
  						      &monc_fops);
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
423
424
  
  	client->osdc.debugfs_file = debugfs_create_file("osdc",
11e1478df   Chengguang Xu   libceph, ceph: ch...
425
  						      0400,
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
426
427
  						      client->debugfs_dir,
  						      client,
072eaf3c0   Ilya Dryomov   libceph: drop CEP...
428
  						      &osdc_fops);
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
429
430
  
  	client->debugfs_monmap = debugfs_create_file("monmap",
11e1478df   Chengguang Xu   libceph, ceph: ch...
431
  					0400,
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
432
433
  					client->debugfs_dir,
  					client,
072eaf3c0   Ilya Dryomov   libceph: drop CEP...
434
  					&monmap_fops);
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
435
436
  
  	client->debugfs_osdmap = debugfs_create_file("osdmap",
11e1478df   Chengguang Xu   libceph, ceph: ch...
437
  					0400,
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
438
439
  					client->debugfs_dir,
  					client,
072eaf3c0   Ilya Dryomov   libceph: drop CEP...
440
  					&osdmap_fops);
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
441

5cf7bd301   Ilya Dryomov   libceph: expose c...
442
  	client->debugfs_options = debugfs_create_file("client_options",
11e1478df   Chengguang Xu   libceph, ceph: ch...
443
  					0400,
5cf7bd301   Ilya Dryomov   libceph: expose c...
444
445
  					client->debugfs_dir,
  					client,
072eaf3c0   Ilya Dryomov   libceph: drop CEP...
446
  					&client_options_fops);
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
447
448
449
450
  }
  
  void ceph_debugfs_client_cleanup(struct ceph_client *client)
  {
d1c338a50   Sage Weil   libceph: delay de...
451
452
  	dout("ceph_debugfs_client_cleanup %p
  ", client);
5cf7bd301   Ilya Dryomov   libceph: expose c...
453
  	debugfs_remove(client->debugfs_options);
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
454
455
456
457
458
459
460
461
  	debugfs_remove(client->debugfs_osdmap);
  	debugfs_remove(client->debugfs_monmap);
  	debugfs_remove(client->osdc.debugfs_file);
  	debugfs_remove(client->monc.debugfs_file);
  	debugfs_remove(client->debugfs_dir);
  }
  
  #else  /* CONFIG_DEBUG_FS */
1a829ff2a   Greg Kroah-Hartman   ceph: no need to ...
462
  void __init ceph_debugfs_init(void)
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
463
  {
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
464
465
466
467
468
  }
  
  void ceph_debugfs_cleanup(void)
  {
  }
1a829ff2a   Greg Kroah-Hartman   ceph: no need to ...
469
  void ceph_debugfs_client_init(struct ceph_client *client)
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
470
  {
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
471
472
473
474
475
476
477
  }
  
  void ceph_debugfs_client_cleanup(struct ceph_client *client)
  {
  }
  
  #endif  /* CONFIG_DEBUG_FS */