^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #include <linux/ceph/ceph_debug.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) #include <linux/device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <linux/ctype.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/debugfs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/seq_file.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/ceph/libceph.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/ceph/mon_client.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/ceph/auth.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/ceph/debugfs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #ifdef CONFIG_DEBUG_FS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * Implement /sys/kernel/debug/ceph fun
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * /sys/kernel/debug/ceph/client* - an instance of the ceph client
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) * .../osdmap - current osdmap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) * .../monmap - current monmap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * .../osdc - active osd requests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * .../monc - mon client state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) * .../client_options - libceph-only (i.e. not rbd or cephfs) options
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) * .../dentry_lru - dump contents of dentry lru
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) * .../caps - expose cap (reservation) stats
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * .../bdi - symlink to ../../bdi/something
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) static struct dentry *ceph_debugfs_dir;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) static int monmap_show(struct seq_file *s, void *p)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) struct ceph_client *client = s->private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) if (client->monc.monmap == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) seq_printf(s, "epoch %d\n", client->monc.monmap->epoch);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) for (i = 0; i < client->monc.monmap->num_mon; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) struct ceph_entity_inst *inst =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) &client->monc.monmap->mon_inst[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) seq_printf(s, "\t%s%lld\t%s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) ENTITY_NAME(inst->name),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) ceph_pr_addr(&inst->addr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) static int osdmap_show(struct seq_file *s, void *p)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) struct ceph_client *client = s->private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) struct ceph_osd_client *osdc = &client->osdc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) struct ceph_osdmap *map = osdc->osdmap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) struct rb_node *n;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) if (map == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) down_read(&osdc->lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) seq_printf(s, "epoch %u barrier %u flags 0x%x\n", map->epoch,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) osdc->epoch_barrier, map->flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) for (n = rb_first(&map->pg_pools); n; n = rb_next(n)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) struct ceph_pg_pool_info *pi =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) rb_entry(n, struct ceph_pg_pool_info, node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 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\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) pi->id, pi->name, pi->type, pi->size, pi->min_size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) pi->pg_num, pi->pg_num_mask, pi->flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) pi->last_force_request_resend, pi->read_tier,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) pi->write_tier);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) for (i = 0; i < map->max_osd; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) struct ceph_entity_addr *addr = &map->osd_addr[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) u32 state = map->osd_state[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) char sb[64];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) seq_printf(s, "osd%d\t%s\t%3d%%\t(%s)\t%3d%%\t%2d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) i, ceph_pr_addr(addr),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) ((map->osd_weight[i]*100) >> 16),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) ceph_osdmap_state_str(sb, sizeof(sb), state),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) ((ceph_get_primary_affinity(map, i)*100) >> 16),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) ceph_get_crush_locality(map, i,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) &client->options->crush_locs));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) for (n = rb_first(&map->pg_temp); n; n = rb_next(n)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) struct ceph_pg_mapping *pg =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) rb_entry(n, struct ceph_pg_mapping, node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) seq_printf(s, "pg_temp %llu.%x [", pg->pgid.pool,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) pg->pgid.seed);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) for (i = 0; i < pg->pg_temp.len; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) seq_printf(s, "%s%d", (i == 0 ? "" : ","),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) pg->pg_temp.osds[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) seq_printf(s, "]\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) for (n = rb_first(&map->primary_temp); n; n = rb_next(n)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) struct ceph_pg_mapping *pg =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) rb_entry(n, struct ceph_pg_mapping, node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) seq_printf(s, "primary_temp %llu.%x %d\n", pg->pgid.pool,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) pg->pgid.seed, pg->primary_temp.osd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) for (n = rb_first(&map->pg_upmap); n; n = rb_next(n)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) struct ceph_pg_mapping *pg =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) rb_entry(n, struct ceph_pg_mapping, node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) seq_printf(s, "pg_upmap %llu.%x [", pg->pgid.pool,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) pg->pgid.seed);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) for (i = 0; i < pg->pg_upmap.len; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) seq_printf(s, "%s%d", (i == 0 ? "" : ","),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) pg->pg_upmap.osds[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) seq_printf(s, "]\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) for (n = rb_first(&map->pg_upmap_items); n; n = rb_next(n)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) struct ceph_pg_mapping *pg =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) rb_entry(n, struct ceph_pg_mapping, node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) seq_printf(s, "pg_upmap_items %llu.%x [", pg->pgid.pool,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) pg->pgid.seed);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) for (i = 0; i < pg->pg_upmap_items.len; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) seq_printf(s, "%s%d->%d", (i == 0 ? "" : ","),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) pg->pg_upmap_items.from_to[i][0],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) pg->pg_upmap_items.from_to[i][1]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) seq_printf(s, "]\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) up_read(&osdc->lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) static int monc_show(struct seq_file *s, void *p)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) struct ceph_client *client = s->private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) struct ceph_mon_generic_request *req;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) struct ceph_mon_client *monc = &client->monc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) struct rb_node *rp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) mutex_lock(&monc->mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) for (i = 0; i < ARRAY_SIZE(monc->subs); i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) seq_printf(s, "have %s %u", ceph_sub_str[i],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) monc->subs[i].have);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) if (monc->subs[i].want)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) seq_printf(s, " want %llu%s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) le64_to_cpu(monc->subs[i].item.start),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) (monc->subs[i].item.flags &
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) CEPH_SUBSCRIBE_ONETIME ? "" : "+"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) seq_putc(s, '\n');
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) seq_printf(s, "fs_cluster_id %d\n", monc->fs_cluster_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) for (rp = rb_first(&monc->generic_request_tree); rp; rp = rb_next(rp)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) __u16 op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) req = rb_entry(rp, struct ceph_mon_generic_request, node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) op = le16_to_cpu(req->request->hdr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) if (op == CEPH_MSG_STATFS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) seq_printf(s, "%llu statfs\n", req->tid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) else if (op == CEPH_MSG_MON_GET_VERSION)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) seq_printf(s, "%llu mon_get_version", req->tid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) seq_printf(s, "%llu unknown\n", req->tid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) mutex_unlock(&monc->mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) static void dump_spgid(struct seq_file *s, const struct ceph_spg *spgid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) seq_printf(s, "%llu.%x", spgid->pgid.pool, spgid->pgid.seed);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) if (spgid->shard != CEPH_SPG_NOSHARD)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) seq_printf(s, "s%d", spgid->shard);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) static void dump_target(struct seq_file *s, struct ceph_osd_request_target *t)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) seq_printf(s, "osd%d\t%llu.%x\t", t->osd, t->pgid.pool, t->pgid.seed);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) dump_spgid(s, &t->spgid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) seq_puts(s, "\t[");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) for (i = 0; i < t->up.size; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) seq_printf(s, "%s%d", (!i ? "" : ","), t->up.osds[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) seq_printf(s, "]/%d\t[", t->up.primary);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) for (i = 0; i < t->acting.size; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) seq_printf(s, "%s%d", (!i ? "" : ","), t->acting.osds[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) seq_printf(s, "]/%d\te%u\t", t->acting.primary, t->epoch);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) if (t->target_oloc.pool_ns) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) seq_printf(s, "%*pE/%*pE\t0x%x",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) (int)t->target_oloc.pool_ns->len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) t->target_oloc.pool_ns->str,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) t->target_oid.name_len, t->target_oid.name, t->flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) seq_printf(s, "%*pE\t0x%x", t->target_oid.name_len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) t->target_oid.name, t->flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) if (t->paused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) seq_puts(s, "\tP");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) static void dump_request(struct seq_file *s, struct ceph_osd_request *req)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) seq_printf(s, "%llu\t", req->r_tid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) dump_target(s, &req->r_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) seq_printf(s, "\t%d", req->r_attempts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) for (i = 0; i < req->r_num_ops; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) struct ceph_osd_req_op *op = &req->r_ops[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) seq_printf(s, "%s%s", (i == 0 ? "\t" : ","),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) ceph_osd_op_name(op->op));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) if (op->op == CEPH_OSD_OP_WATCH)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) seq_printf(s, "-%s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) ceph_osd_watch_op_name(op->watch.op));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) else if (op->op == CEPH_OSD_OP_CALL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) seq_printf(s, "-%s/%s", op->cls.class_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) op->cls.method_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) seq_putc(s, '\n');
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) static void dump_requests(struct seq_file *s, struct ceph_osd *osd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) struct rb_node *n;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) mutex_lock(&osd->lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) for (n = rb_first(&osd->o_requests); n; n = rb_next(n)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) struct ceph_osd_request *req =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) rb_entry(n, struct ceph_osd_request, r_node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) dump_request(s, req);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) mutex_unlock(&osd->lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) static void dump_linger_request(struct seq_file *s,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) struct ceph_osd_linger_request *lreq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) seq_printf(s, "%llu\t", lreq->linger_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) dump_target(s, &lreq->t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) seq_printf(s, "\t%u\t%s%s/%d\n", lreq->register_gen,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) lreq->is_watch ? "W" : "N", lreq->committed ? "C" : "",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) lreq->last_error);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) static void dump_linger_requests(struct seq_file *s, struct ceph_osd *osd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) struct rb_node *n;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) mutex_lock(&osd->lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) for (n = rb_first(&osd->o_linger_requests); n; n = rb_next(n)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) struct ceph_osd_linger_request *lreq =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) rb_entry(n, struct ceph_osd_linger_request, node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) dump_linger_request(s, lreq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) mutex_unlock(&osd->lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) static void dump_snapid(struct seq_file *s, u64 snapid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) if (snapid == CEPH_NOSNAP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) seq_puts(s, "head");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) else if (snapid == CEPH_SNAPDIR)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) seq_puts(s, "snapdir");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) seq_printf(s, "%llx", snapid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) static void dump_name_escaped(struct seq_file *s, unsigned char *name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) size_t len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) size_t i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) for (i = 0; i < len; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) if (name[i] == '%' || name[i] == ':' || name[i] == '/' ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) name[i] < 32 || name[i] >= 127) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) seq_printf(s, "%%%02x", name[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) seq_putc(s, name[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) static void dump_hoid(struct seq_file *s, const struct ceph_hobject_id *hoid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) if (hoid->snapid == 0 && hoid->hash == 0 && !hoid->is_max &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) hoid->pool == S64_MIN) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) seq_puts(s, "MIN");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) if (hoid->is_max) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) seq_puts(s, "MAX");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) seq_printf(s, "%lld:%08x:", hoid->pool, hoid->hash_reverse_bits);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) dump_name_escaped(s, hoid->nspace, hoid->nspace_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) seq_putc(s, ':');
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) dump_name_escaped(s, hoid->key, hoid->key_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) seq_putc(s, ':');
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) dump_name_escaped(s, hoid->oid, hoid->oid_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) seq_putc(s, ':');
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) dump_snapid(s, hoid->snapid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) static void dump_backoffs(struct seq_file *s, struct ceph_osd *osd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) struct rb_node *n;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) mutex_lock(&osd->lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) for (n = rb_first(&osd->o_backoffs_by_id); n; n = rb_next(n)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) struct ceph_osd_backoff *backoff =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) rb_entry(n, struct ceph_osd_backoff, id_node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) seq_printf(s, "osd%d\t", osd->o_osd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) dump_spgid(s, &backoff->spgid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) seq_printf(s, "\t%llu\t", backoff->id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) dump_hoid(s, backoff->begin);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) seq_putc(s, '\t');
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) dump_hoid(s, backoff->end);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) seq_putc(s, '\n');
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) mutex_unlock(&osd->lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) static int osdc_show(struct seq_file *s, void *pp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) struct ceph_client *client = s->private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) struct ceph_osd_client *osdc = &client->osdc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) struct rb_node *n;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) down_read(&osdc->lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) seq_printf(s, "REQUESTS %d homeless %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) atomic_read(&osdc->num_requests),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) atomic_read(&osdc->num_homeless));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) for (n = rb_first(&osdc->osds); n; n = rb_next(n)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) struct ceph_osd *osd = rb_entry(n, struct ceph_osd, o_node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) dump_requests(s, osd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) dump_requests(s, &osdc->homeless_osd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) seq_puts(s, "LINGER REQUESTS\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) for (n = rb_first(&osdc->osds); n; n = rb_next(n)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) struct ceph_osd *osd = rb_entry(n, struct ceph_osd, o_node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) dump_linger_requests(s, osd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) dump_linger_requests(s, &osdc->homeless_osd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) seq_puts(s, "BACKOFFS\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) for (n = rb_first(&osdc->osds); n; n = rb_next(n)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) struct ceph_osd *osd = rb_entry(n, struct ceph_osd, o_node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) dump_backoffs(s, osd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) up_read(&osdc->lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) static int client_options_show(struct seq_file *s, void *p)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) struct ceph_client *client = s->private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) ret = ceph_print_client_options(s, client, true);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) seq_putc(s, '\n');
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) DEFINE_SHOW_ATTRIBUTE(monmap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) DEFINE_SHOW_ATTRIBUTE(osdmap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) DEFINE_SHOW_ATTRIBUTE(monc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) DEFINE_SHOW_ATTRIBUTE(osdc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) DEFINE_SHOW_ATTRIBUTE(client_options);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) void __init ceph_debugfs_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) ceph_debugfs_dir = debugfs_create_dir("ceph", NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) void ceph_debugfs_cleanup(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) debugfs_remove(ceph_debugfs_dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) void ceph_debugfs_client_init(struct ceph_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) char name[80];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) snprintf(name, sizeof(name), "%pU.client%lld", &client->fsid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) client->monc.auth->global_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) dout("ceph_debugfs_client_init %p %s\n", client, name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) client->debugfs_dir = debugfs_create_dir(name, ceph_debugfs_dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) client->monc.debugfs_file = debugfs_create_file("monc",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) 0400,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) client->debugfs_dir,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) &monc_fops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) client->osdc.debugfs_file = debugfs_create_file("osdc",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) 0400,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) client->debugfs_dir,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) &osdc_fops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) client->debugfs_monmap = debugfs_create_file("monmap",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) 0400,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) client->debugfs_dir,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) &monmap_fops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) client->debugfs_osdmap = debugfs_create_file("osdmap",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) 0400,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) client->debugfs_dir,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) &osdmap_fops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) client->debugfs_options = debugfs_create_file("client_options",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) 0400,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) client->debugfs_dir,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) &client_options_fops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) void ceph_debugfs_client_cleanup(struct ceph_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) dout("ceph_debugfs_client_cleanup %p\n", client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) debugfs_remove(client->debugfs_options);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) debugfs_remove(client->debugfs_osdmap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) debugfs_remove(client->debugfs_monmap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) debugfs_remove(client->osdc.debugfs_file);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) debugfs_remove(client->monc.debugfs_file);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) debugfs_remove(client->debugfs_dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) #else /* CONFIG_DEBUG_FS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) void __init ceph_debugfs_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) void ceph_debugfs_cleanup(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) void ceph_debugfs_client_init(struct ceph_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) void ceph_debugfs_client_cleanup(struct ceph_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) #endif /* CONFIG_DEBUG_FS */