summaryrefslogtreecommitdiffstats
path: root/net/ceph/debugfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ceph/debugfs.c')
-rw-r--r--net/ceph/debugfs.c147
1 files changed, 110 insertions, 37 deletions
diff --git a/net/ceph/debugfs.c b/net/ceph/debugfs.c
index b902fbc7863e..e77b04ca7802 100644
--- a/net/ceph/debugfs.c
+++ b/net/ceph/debugfs.c
@@ -54,24 +54,25 @@ static int osdmap_show(struct seq_file *s, void *p)
54{ 54{
55 int i; 55 int i;
56 struct ceph_client *client = s->private; 56 struct ceph_client *client = s->private;
57 struct ceph_osdmap *map = client->osdc.osdmap; 57 struct ceph_osd_client *osdc = &client->osdc;
58 struct ceph_osdmap *map = osdc->osdmap;
58 struct rb_node *n; 59 struct rb_node *n;
59 60
60 if (map == NULL) 61 if (map == NULL)
61 return 0; 62 return 0;
62 63
63 seq_printf(s, "epoch %d\n", map->epoch); 64 down_read(&osdc->lock);
64 seq_printf(s, "flags%s%s\n", 65 seq_printf(s, "epoch %d flags 0x%x\n", map->epoch, map->flags);
65 (map->flags & CEPH_OSDMAP_NEARFULL) ? " NEARFULL" : "",
66 (map->flags & CEPH_OSDMAP_FULL) ? " FULL" : "");
67 66
68 for (n = rb_first(&map->pg_pools); n; n = rb_next(n)) { 67 for (n = rb_first(&map->pg_pools); n; n = rb_next(n)) {
69 struct ceph_pg_pool_info *pool = 68 struct ceph_pg_pool_info *pi =
70 rb_entry(n, struct ceph_pg_pool_info, node); 69 rb_entry(n, struct ceph_pg_pool_info, node);
71 70
72 seq_printf(s, "pool %lld pg_num %u (%d) read_tier %lld write_tier %lld\n", 71 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",
73 pool->id, pool->pg_num, pool->pg_num_mask, 72 pi->id, pi->name, pi->type, pi->size, pi->min_size,
74 pool->read_tier, pool->write_tier); 73 pi->pg_num, pi->pg_num_mask, pi->flags,
74 pi->last_force_request_resend, pi->read_tier,
75 pi->write_tier);
75 } 76 }
76 for (i = 0; i < map->max_osd; i++) { 77 for (i = 0; i < map->max_osd; i++) {
77 struct ceph_entity_addr *addr = &map->osd_addr[i]; 78 struct ceph_entity_addr *addr = &map->osd_addr[i];
@@ -103,6 +104,7 @@ static int osdmap_show(struct seq_file *s, void *p)
103 pg->pgid.seed, pg->primary_temp.osd); 104 pg->pgid.seed, pg->primary_temp.osd);
104 } 105 }
105 106
107 up_read(&osdc->lock);
106 return 0; 108 return 0;
107} 109}
108 110
@@ -126,6 +128,7 @@ static int monc_show(struct seq_file *s, void *p)
126 CEPH_SUBSCRIBE_ONETIME ? "" : "+")); 128 CEPH_SUBSCRIBE_ONETIME ? "" : "+"));
127 seq_putc(s, '\n'); 129 seq_putc(s, '\n');
128 } 130 }
131 seq_printf(s, "fs_cluster_id %d\n", monc->fs_cluster_id);
129 132
130 for (rp = rb_first(&monc->generic_request_tree); rp; rp = rb_next(rp)) { 133 for (rp = rb_first(&monc->generic_request_tree); rp; rp = rb_next(rp)) {
131 __u16 op; 134 __u16 op;
@@ -143,43 +146,113 @@ static int monc_show(struct seq_file *s, void *p)
143 return 0; 146 return 0;
144} 147}
145 148
146static int osdc_show(struct seq_file *s, void *pp) 149static void dump_target(struct seq_file *s, struct ceph_osd_request_target *t)
147{ 150{
148 struct ceph_client *client = s->private; 151 int i;
149 struct ceph_osd_client *osdc = &client->osdc;
150 struct rb_node *p;
151 152
152 mutex_lock(&osdc->request_mutex); 153 seq_printf(s, "osd%d\t%llu.%x\t[", t->osd, t->pgid.pool, t->pgid.seed);
153 for (p = rb_first(&osdc->requests); p; p = rb_next(p)) { 154 for (i = 0; i < t->up.size; i++)
154 struct ceph_osd_request *req; 155 seq_printf(s, "%s%d", (!i ? "" : ","), t->up.osds[i]);
155 unsigned int i; 156 seq_printf(s, "]/%d\t[", t->up.primary);
156 int opcode; 157 for (i = 0; i < t->acting.size; i++)
158 seq_printf(s, "%s%d", (!i ? "" : ","), t->acting.osds[i]);
159 seq_printf(s, "]/%d\t%*pE\t0x%x", t->acting.primary,
160 t->target_oid.name_len, t->target_oid.name, t->flags);
161 if (t->paused)
162 seq_puts(s, "\tP");
163}
157 164
158 req = rb_entry(p, struct ceph_osd_request, r_node); 165static void dump_request(struct seq_file *s, struct ceph_osd_request *req)
166{
167 int i;
159 168
160 seq_printf(s, "%lld\tosd%d\t%lld.%x\t", req->r_tid, 169 seq_printf(s, "%llu\t", req->r_tid);
161 req->r_osd ? req->r_osd->o_osd : -1, 170 dump_target(s, &req->r_t);
162 req->r_pgid.pool, req->r_pgid.seed);
163 171
164 seq_printf(s, "%.*s", req->r_base_oid.name_len, 172 seq_printf(s, "\t%d\t%u'%llu", req->r_attempts,
165 req->r_base_oid.name); 173 le32_to_cpu(req->r_replay_version.epoch),
174 le64_to_cpu(req->r_replay_version.version));
166 175
167 if (req->r_reassert_version.epoch) 176 for (i = 0; i < req->r_num_ops; i++) {
168 seq_printf(s, "\t%u'%llu", 177 struct ceph_osd_req_op *op = &req->r_ops[i];
169 (unsigned int)le32_to_cpu(req->r_reassert_version.epoch), 178
170 le64_to_cpu(req->r_reassert_version.version)); 179 seq_printf(s, "%s%s", (i == 0 ? "\t" : ","),
171 else 180 ceph_osd_op_name(op->op));
172 seq_printf(s, "\t"); 181 if (op->op == CEPH_OSD_OP_WATCH)
182 seq_printf(s, "-%s",
183 ceph_osd_watch_op_name(op->watch.op));
184 }
185
186 seq_putc(s, '\n');
187}
188
189static void dump_requests(struct seq_file *s, struct ceph_osd *osd)
190{
191 struct rb_node *n;
192
193 mutex_lock(&osd->lock);
194 for (n = rb_first(&osd->o_requests); n; n = rb_next(n)) {
195 struct ceph_osd_request *req =
196 rb_entry(n, struct ceph_osd_request, r_node);
197
198 dump_request(s, req);
199 }
200
201 mutex_unlock(&osd->lock);
202}
173 203
174 for (i = 0; i < req->r_num_ops; i++) { 204static void dump_linger_request(struct seq_file *s,
175 opcode = req->r_ops[i].op; 205 struct ceph_osd_linger_request *lreq)
176 seq_printf(s, "%s%s", (i == 0 ? "\t" : ","), 206{
177 ceph_osd_op_name(opcode)); 207 seq_printf(s, "%llu\t", lreq->linger_id);
178 } 208 dump_target(s, &lreq->t);
209
210 seq_printf(s, "\t%u\t%s%s/%d\n", lreq->register_gen,
211 lreq->is_watch ? "W" : "N", lreq->committed ? "C" : "",
212 lreq->last_error);
213}
214
215static void dump_linger_requests(struct seq_file *s, struct ceph_osd *osd)
216{
217 struct rb_node *n;
218
219 mutex_lock(&osd->lock);
220 for (n = rb_first(&osd->o_linger_requests); n; n = rb_next(n)) {
221 struct ceph_osd_linger_request *lreq =
222 rb_entry(n, struct ceph_osd_linger_request, node);
223
224 dump_linger_request(s, lreq);
225 }
226
227 mutex_unlock(&osd->lock);
228}
179 229
180 seq_printf(s, "\n"); 230static int osdc_show(struct seq_file *s, void *pp)
231{
232 struct ceph_client *client = s->private;
233 struct ceph_osd_client *osdc = &client->osdc;
234 struct rb_node *n;
235
236 down_read(&osdc->lock);
237 seq_printf(s, "REQUESTS %d homeless %d\n",
238 atomic_read(&osdc->num_requests),
239 atomic_read(&osdc->num_homeless));
240 for (n = rb_first(&osdc->osds); n; n = rb_next(n)) {
241 struct ceph_osd *osd = rb_entry(n, struct ceph_osd, o_node);
242
243 dump_requests(s, osd);
181 } 244 }
182 mutex_unlock(&osdc->request_mutex); 245 dump_requests(s, &osdc->homeless_osd);
246
247 seq_puts(s, "LINGER REQUESTS\n");
248 for (n = rb_first(&osdc->osds); n; n = rb_next(n)) {
249 struct ceph_osd *osd = rb_entry(n, struct ceph_osd, o_node);
250
251 dump_linger_requests(s, osd);
252 }
253 dump_linger_requests(s, &osdc->homeless_osd);
254
255 up_read(&osdc->lock);
183 return 0; 256 return 0;
184} 257}
185 258