static int osdmap_show(struct seq_file *s, void *p) { int i; struct ceph_client *client = s->private; struct ceph_osdmap *map = client->osdc.osdmap; struct rb_node *n; if (map == NULL) return 0; seq_printf(s, "epoch %d\n", map->epoch); seq_printf(s, "flags%s%s\n", (map->flags & CEPH_OSDMAP_NEARFULL) ? " NEARFULL" : "", (map->flags & CEPH_OSDMAP_FULL) ? " FULL" : ""); for (n = rb_first(&map->pg_pools); n; n = rb_next(n)) { struct ceph_pg_pool_info *pool = rb_entry(n, struct ceph_pg_pool_info, node); seq_printf(s, "pool %lld pg_num %u (%d) read_tier %lld write_tier %lld\n", pool->id, pool->pg_num, pool->pg_num_mask, pool->read_tier, pool->write_tier); } for (i = 0; i < map->max_osd; i++) { struct ceph_entity_addr *addr = &map->osd_addr[i]; int state = map->osd_state[i]; char sb[64]; seq_printf(s, "osd%d\t%s\t%3d%%\t(%s)\t%3d%%\n", i, ceph_pr_addr(&addr->in_addr), ((map->osd_weight[i]*100) >> 16), ceph_osdmap_state_str(sb, sizeof(sb), state), ((ceph_get_primary_affinity(map, i)*100) >> 16)); } 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); for (i = 0; i < pg->pg_temp.len; i++) seq_printf(s, "%s%d", (i == 0 ? "" : ","), pg->pg_temp.osds[i]); seq_printf(s, "]\n"); } 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\n", pg->pgid.pool, pg->pgid.seed, pg->primary_temp.osd); } return 0; }
static int osdmap_show(struct seq_file *s, void *p) { int i; struct ceph_client *client = s->private; struct ceph_osd_client *osdc = &client->osdc; struct ceph_osdmap *map = osdc->osdmap; struct rb_node *n; if (map == NULL) return 0; down_read(&osdc->lock); seq_printf(s, "epoch %u barrier %u flags 0x%x\n", map->epoch, osdc->epoch_barrier, map->flags); for (n = rb_first(&map->pg_pools); n; n = rb_next(n)) { struct ceph_pg_pool_info *pi = rb_entry(n, struct ceph_pg_pool_info, node); 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", 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); } for (i = 0; i < map->max_osd; i++) { struct ceph_entity_addr *addr = &map->osd_addr[i]; u32 state = map->osd_state[i]; char sb[64]; seq_printf(s, "osd%d\t%s\t%3d%%\t(%s)\t%3d%%\n", i, ceph_pr_addr(&addr->in_addr), ((map->osd_weight[i]*100) >> 16), ceph_osdmap_state_str(sb, sizeof(sb), state), ((ceph_get_primary_affinity(map, i)*100) >> 16)); } 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); for (i = 0; i < pg->pg_temp.len; i++) seq_printf(s, "%s%d", (i == 0 ? "" : ","), pg->pg_temp.osds[i]); seq_printf(s, "]\n"); } 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\n", pg->pgid.pool, pg->pgid.seed, pg->primary_temp.osd); } 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, "]\n"); } 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, "]\n"); } up_read(&osdc->lock); return 0; }