Lines Matching +full:- +full:s
1 // SPDX-License-Identifier: GPL-2.0
21 * /sys/kernel/debug/ceph/client* - an instance of the ceph client
22 * .../osdmap - current osdmap
23 * .../monmap - current monmap
24 * .../osdc - active osd requests
25 * .../monc - mon client state
26 * .../client_options - libceph-only (i.e. not rbd or cephfs) options
27 * .../dentry_lru - dump contents of dentry lru
28 * .../caps - expose cap (reservation) stats
29 * .../bdi - symlink to ../../bdi/something
34 static int monmap_show(struct seq_file *s, void *p) in monmap_show() argument
37 struct ceph_client *client = s->private; in monmap_show()
39 if (client->monc.monmap == NULL) in monmap_show()
42 seq_printf(s, "epoch %d\n", client->monc.monmap->epoch); in monmap_show()
43 for (i = 0; i < client->monc.monmap->num_mon; i++) { in monmap_show()
45 &client->monc.monmap->mon_inst[i]; in monmap_show()
47 seq_printf(s, "\t%s%lld\t%s\n", in monmap_show()
48 ENTITY_NAME(inst->name), in monmap_show()
49 ceph_pr_addr(&inst->addr)); in monmap_show()
54 static int osdmap_show(struct seq_file *s, void *p) in osdmap_show() argument
57 struct ceph_client *client = s->private; in osdmap_show()
58 struct ceph_osd_client *osdc = &client->osdc; in osdmap_show()
59 struct ceph_osdmap *map = osdc->osdmap; in osdmap_show()
65 down_read(&osdc->lock); in osdmap_show()
66 seq_printf(s, "epoch %u barrier %u flags 0x%x\n", map->epoch, in osdmap_show()
67 osdc->epoch_barrier, map->flags); in osdmap_show()
69 for (n = rb_first(&map->pg_pools); n; n = rb_next(n)) { in osdmap_show()
73 …seq_printf(s, "pool %lld '%s' type %d size %d min_size %d pg_num %u pg_num_mask %d flags 0x%llx lf… in osdmap_show()
74 pi->id, pi->name, pi->type, pi->size, pi->min_size, in osdmap_show()
75 pi->pg_num, pi->pg_num_mask, pi->flags, in osdmap_show()
76 pi->last_force_request_resend, pi->read_tier, in osdmap_show()
77 pi->write_tier); in osdmap_show()
79 for (i = 0; i < map->max_osd; i++) { in osdmap_show()
80 struct ceph_entity_addr *addr = &map->osd_addr[i]; in osdmap_show()
81 u32 state = map->osd_state[i]; in osdmap_show()
84 seq_printf(s, "osd%d\t%s\t%3d%%\t(%s)\t%3d%%\t%2d\n", in osdmap_show()
86 ((map->osd_weight[i]*100) >> 16), in osdmap_show()
90 &client->options->crush_locs)); in osdmap_show()
92 for (n = rb_first(&map->pg_temp); n; n = rb_next(n)) { in osdmap_show()
96 seq_printf(s, "pg_temp %llu.%x [", pg->pgid.pool, in osdmap_show()
97 pg->pgid.seed); in osdmap_show()
98 for (i = 0; i < pg->pg_temp.len; i++) in osdmap_show()
99 seq_printf(s, "%s%d", (i == 0 ? "" : ","), in osdmap_show()
100 pg->pg_temp.osds[i]); in osdmap_show()
101 seq_printf(s, "]\n"); in osdmap_show()
103 for (n = rb_first(&map->primary_temp); n; n = rb_next(n)) { in osdmap_show()
107 seq_printf(s, "primary_temp %llu.%x %d\n", pg->pgid.pool, in osdmap_show()
108 pg->pgid.seed, pg->primary_temp.osd); in osdmap_show()
110 for (n = rb_first(&map->pg_upmap); n; n = rb_next(n)) { in osdmap_show()
114 seq_printf(s, "pg_upmap %llu.%x [", pg->pgid.pool, in osdmap_show()
115 pg->pgid.seed); in osdmap_show()
116 for (i = 0; i < pg->pg_upmap.len; i++) in osdmap_show()
117 seq_printf(s, "%s%d", (i == 0 ? "" : ","), in osdmap_show()
118 pg->pg_upmap.osds[i]); in osdmap_show()
119 seq_printf(s, "]\n"); in osdmap_show()
121 for (n = rb_first(&map->pg_upmap_items); n; n = rb_next(n)) { in osdmap_show()
125 seq_printf(s, "pg_upmap_items %llu.%x [", pg->pgid.pool, in osdmap_show()
126 pg->pgid.seed); in osdmap_show()
127 for (i = 0; i < pg->pg_upmap_items.len; i++) in osdmap_show()
128 seq_printf(s, "%s%d->%d", (i == 0 ? "" : ","), in osdmap_show()
129 pg->pg_upmap_items.from_to[i][0], in osdmap_show()
130 pg->pg_upmap_items.from_to[i][1]); in osdmap_show()
131 seq_printf(s, "]\n"); in osdmap_show()
134 up_read(&osdc->lock); in osdmap_show()
138 static int monc_show(struct seq_file *s, void *p) in monc_show() argument
140 struct ceph_client *client = s->private; in monc_show()
142 struct ceph_mon_client *monc = &client->monc; in monc_show()
146 mutex_lock(&monc->mutex); in monc_show()
148 for (i = 0; i < ARRAY_SIZE(monc->subs); i++) { in monc_show()
149 seq_printf(s, "have %s %u", ceph_sub_str[i], in monc_show()
150 monc->subs[i].have); in monc_show()
151 if (monc->subs[i].want) in monc_show()
152 seq_printf(s, " want %llu%s", in monc_show()
153 le64_to_cpu(monc->subs[i].item.start), in monc_show()
154 (monc->subs[i].item.flags & in monc_show()
156 seq_putc(s, '\n'); in monc_show()
158 seq_printf(s, "fs_cluster_id %d\n", monc->fs_cluster_id); in monc_show()
160 for (rp = rb_first(&monc->generic_request_tree); rp; rp = rb_next(rp)) { in monc_show()
163 op = le16_to_cpu(req->request->hdr.type); in monc_show()
165 seq_printf(s, "%llu statfs\n", req->tid); in monc_show()
167 seq_printf(s, "%llu mon_get_version", req->tid); in monc_show()
169 seq_printf(s, "%llu unknown\n", req->tid); in monc_show()
172 mutex_unlock(&monc->mutex); in monc_show()
176 static void dump_spgid(struct seq_file *s, const struct ceph_spg *spgid) in dump_spgid() argument
178 seq_printf(s, "%llu.%x", spgid->pgid.pool, spgid->pgid.seed); in dump_spgid()
179 if (spgid->shard != CEPH_SPG_NOSHARD) in dump_spgid()
180 seq_printf(s, "s%d", spgid->shard); in dump_spgid()
183 static void dump_target(struct seq_file *s, struct ceph_osd_request_target *t) in dump_target() argument
187 seq_printf(s, "osd%d\t%llu.%x\t", t->osd, t->pgid.pool, t->pgid.seed); in dump_target()
188 dump_spgid(s, &t->spgid); in dump_target()
189 seq_puts(s, "\t["); in dump_target()
190 for (i = 0; i < t->up.size; i++) in dump_target()
191 seq_printf(s, "%s%d", (!i ? "" : ","), t->up.osds[i]); in dump_target()
192 seq_printf(s, "]/%d\t[", t->up.primary); in dump_target()
193 for (i = 0; i < t->acting.size; i++) in dump_target()
194 seq_printf(s, "%s%d", (!i ? "" : ","), t->acting.osds[i]); in dump_target()
195 seq_printf(s, "]/%d\te%u\t", t->acting.primary, t->epoch); in dump_target()
196 if (t->target_oloc.pool_ns) { in dump_target()
197 seq_printf(s, "%*pE/%*pE\t0x%x", in dump_target()
198 (int)t->target_oloc.pool_ns->len, in dump_target()
199 t->target_oloc.pool_ns->str, in dump_target()
200 t->target_oid.name_len, t->target_oid.name, t->flags); in dump_target()
202 seq_printf(s, "%*pE\t0x%x", t->target_oid.name_len, in dump_target()
203 t->target_oid.name, t->flags); in dump_target()
205 if (t->paused) in dump_target()
206 seq_puts(s, "\tP"); in dump_target()
209 static void dump_request(struct seq_file *s, struct ceph_osd_request *req) in dump_request() argument
213 seq_printf(s, "%llu\t", req->r_tid); in dump_request()
214 dump_target(s, &req->r_t); in dump_request()
216 seq_printf(s, "\t%d", req->r_attempts); in dump_request()
218 for (i = 0; i < req->r_num_ops; i++) { in dump_request()
219 struct ceph_osd_req_op *op = &req->r_ops[i]; in dump_request()
221 seq_printf(s, "%s%s", (i == 0 ? "\t" : ","), in dump_request()
222 ceph_osd_op_name(op->op)); in dump_request()
223 if (op->op == CEPH_OSD_OP_WATCH) in dump_request()
224 seq_printf(s, "-%s", in dump_request()
225 ceph_osd_watch_op_name(op->watch.op)); in dump_request()
226 else if (op->op == CEPH_OSD_OP_CALL) in dump_request()
227 seq_printf(s, "-%s/%s", op->cls.class_name, in dump_request()
228 op->cls.method_name); in dump_request()
231 seq_putc(s, '\n'); in dump_request()
234 static void dump_requests(struct seq_file *s, struct ceph_osd *osd) in dump_requests() argument
238 mutex_lock(&osd->lock); in dump_requests()
239 for (n = rb_first(&osd->o_requests); n; n = rb_next(n)) { in dump_requests()
243 dump_request(s, req); in dump_requests()
246 mutex_unlock(&osd->lock); in dump_requests()
249 static void dump_linger_request(struct seq_file *s, in dump_linger_request() argument
252 seq_printf(s, "%llu\t", lreq->linger_id); in dump_linger_request()
253 dump_target(s, &lreq->t); in dump_linger_request()
255 seq_printf(s, "\t%u\t%s%s/%d\n", lreq->register_gen, in dump_linger_request()
256 lreq->is_watch ? "W" : "N", lreq->committed ? "C" : "", in dump_linger_request()
257 lreq->last_error); in dump_linger_request()
260 static void dump_linger_requests(struct seq_file *s, struct ceph_osd *osd) in dump_linger_requests() argument
264 mutex_lock(&osd->lock); in dump_linger_requests()
265 for (n = rb_first(&osd->o_linger_requests); n; n = rb_next(n)) { in dump_linger_requests()
269 dump_linger_request(s, lreq); in dump_linger_requests()
272 mutex_unlock(&osd->lock); in dump_linger_requests()
275 static void dump_snapid(struct seq_file *s, u64 snapid) in dump_snapid() argument
278 seq_puts(s, "head"); in dump_snapid()
280 seq_puts(s, "snapdir"); in dump_snapid()
282 seq_printf(s, "%llx", snapid); in dump_snapid()
285 static void dump_name_escaped(struct seq_file *s, unsigned char *name, in dump_name_escaped() argument
293 seq_printf(s, "%%%02x", name[i]); in dump_name_escaped()
295 seq_putc(s, name[i]); in dump_name_escaped()
300 static void dump_hoid(struct seq_file *s, const struct ceph_hobject_id *hoid) in dump_hoid() argument
302 if (hoid->snapid == 0 && hoid->hash == 0 && !hoid->is_max && in dump_hoid()
303 hoid->pool == S64_MIN) { in dump_hoid()
304 seq_puts(s, "MIN"); in dump_hoid()
307 if (hoid->is_max) { in dump_hoid()
308 seq_puts(s, "MAX"); in dump_hoid()
311 seq_printf(s, "%lld:%08x:", hoid->pool, hoid->hash_reverse_bits); in dump_hoid()
312 dump_name_escaped(s, hoid->nspace, hoid->nspace_len); in dump_hoid()
313 seq_putc(s, ':'); in dump_hoid()
314 dump_name_escaped(s, hoid->key, hoid->key_len); in dump_hoid()
315 seq_putc(s, ':'); in dump_hoid()
316 dump_name_escaped(s, hoid->oid, hoid->oid_len); in dump_hoid()
317 seq_putc(s, ':'); in dump_hoid()
318 dump_snapid(s, hoid->snapid); in dump_hoid()
321 static void dump_backoffs(struct seq_file *s, struct ceph_osd *osd) in dump_backoffs() argument
325 mutex_lock(&osd->lock); in dump_backoffs()
326 for (n = rb_first(&osd->o_backoffs_by_id); n; n = rb_next(n)) { in dump_backoffs()
330 seq_printf(s, "osd%d\t", osd->o_osd); in dump_backoffs()
331 dump_spgid(s, &backoff->spgid); in dump_backoffs()
332 seq_printf(s, "\t%llu\t", backoff->id); in dump_backoffs()
333 dump_hoid(s, backoff->begin); in dump_backoffs()
334 seq_putc(s, '\t'); in dump_backoffs()
335 dump_hoid(s, backoff->end); in dump_backoffs()
336 seq_putc(s, '\n'); in dump_backoffs()
339 mutex_unlock(&osd->lock); in dump_backoffs()
342 static int osdc_show(struct seq_file *s, void *pp) in osdc_show() argument
344 struct ceph_client *client = s->private; in osdc_show()
345 struct ceph_osd_client *osdc = &client->osdc; in osdc_show()
348 down_read(&osdc->lock); in osdc_show()
349 seq_printf(s, "REQUESTS %d homeless %d\n", in osdc_show()
350 atomic_read(&osdc->num_requests), in osdc_show()
351 atomic_read(&osdc->num_homeless)); in osdc_show()
352 for (n = rb_first(&osdc->osds); n; n = rb_next(n)) { in osdc_show()
355 dump_requests(s, osd); in osdc_show()
357 dump_requests(s, &osdc->homeless_osd); in osdc_show()
359 seq_puts(s, "LINGER REQUESTS\n"); in osdc_show()
360 for (n = rb_first(&osdc->osds); n; n = rb_next(n)) { in osdc_show()
363 dump_linger_requests(s, osd); in osdc_show()
365 dump_linger_requests(s, &osdc->homeless_osd); in osdc_show()
367 seq_puts(s, "BACKOFFS\n"); in osdc_show()
368 for (n = rb_first(&osdc->osds); n; n = rb_next(n)) { in osdc_show()
371 dump_backoffs(s, osd); in osdc_show()
374 up_read(&osdc->lock); in osdc_show()
378 static int client_options_show(struct seq_file *s, void *p) in client_options_show() argument
380 struct ceph_client *client = s->private; in client_options_show()
383 ret = ceph_print_client_options(s, client, true); in client_options_show()
387 seq_putc(s, '\n'); in client_options_show()
411 snprintf(name, sizeof(name), "%pU.client%lld", &client->fsid, in ceph_debugfs_client_init()
412 client->monc.auth->global_id); in ceph_debugfs_client_init()
414 dout("ceph_debugfs_client_init %p %s\n", client, name); in ceph_debugfs_client_init()
416 client->debugfs_dir = debugfs_create_dir(name, ceph_debugfs_dir); in ceph_debugfs_client_init()
418 client->monc.debugfs_file = debugfs_create_file("monc", in ceph_debugfs_client_init()
420 client->debugfs_dir, in ceph_debugfs_client_init()
424 client->osdc.debugfs_file = debugfs_create_file("osdc", in ceph_debugfs_client_init()
426 client->debugfs_dir, in ceph_debugfs_client_init()
430 client->debugfs_monmap = debugfs_create_file("monmap", in ceph_debugfs_client_init()
432 client->debugfs_dir, in ceph_debugfs_client_init()
436 client->debugfs_osdmap = debugfs_create_file("osdmap", in ceph_debugfs_client_init()
438 client->debugfs_dir, in ceph_debugfs_client_init()
442 client->debugfs_options = debugfs_create_file("client_options", in ceph_debugfs_client_init()
444 client->debugfs_dir, in ceph_debugfs_client_init()
452 debugfs_remove(client->debugfs_options); in ceph_debugfs_client_cleanup()
453 debugfs_remove(client->debugfs_osdmap); in ceph_debugfs_client_cleanup()
454 debugfs_remove(client->debugfs_monmap); in ceph_debugfs_client_cleanup()
455 debugfs_remove(client->osdc.debugfs_file); in ceph_debugfs_client_cleanup()
456 debugfs_remove(client->monc.debugfs_file); in ceph_debugfs_client_cleanup()
457 debugfs_remove(client->debugfs_dir); in ceph_debugfs_client_cleanup()