summaryrefslogtreecommitdiffstats
path: root/net/ceph/debugfs.c
diff options
context:
space:
mode:
authorIlya Dryomov <idryomov@gmail.com>2016-05-25 18:29:52 -0400
committerIlya Dryomov <idryomov@gmail.com>2016-05-25 18:36:27 -0400
commitbb873b539154ab51893430b4ad6ba4051775276a (patch)
tree9415938962eddb3d83e89bfa00eaab803b196bb6 /net/ceph/debugfs.c
parenta66dd38309f5d9c66ec9bc7911ff8da8cc37bb9f (diff)
libceph: switch to calc_target(), part 2
The crux of this is getting rid of ceph_osdc_build_request(), so that MOSDOp can be encoded not before but after calc_target() calculates the actual target. Encoding now happens within ceph_osdc_start_request(). Also nuked is the accompanying bunch of pointers into the encoded buffer that was used to update fields on each send - instead, the entire front is re-encoded. If we want to support target->name_len != base->name_len in the future, there is no other way, because oid is surrounded by other fields in the encoded buffer. Encoding OSD ops and adding data items to the request message were mixed together in osd_req_encode_op(). While we want to re-encode OSD ops, we don't want to add duplicate data items to the message when resending, so all call to ceph_osdc_msg_data_add() are factored out into a new setup_request_data(). Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'net/ceph/debugfs.c')
-rw-r--r--net/ceph/debugfs.c61
1 files changed, 38 insertions, 23 deletions
diff --git a/net/ceph/debugfs.c b/net/ceph/debugfs.c
index 0c11ab5f8c30..6d3ff713edeb 100644
--- a/net/ceph/debugfs.c
+++ b/net/ceph/debugfs.c
@@ -145,6 +145,43 @@ static int monc_show(struct seq_file *s, void *p)
145 return 0; 145 return 0;
146} 146}
147 147
148static void dump_target(struct seq_file *s, struct ceph_osd_request_target *t)
149{
150 int i;
151
152 seq_printf(s, "osd%d\t%llu.%x\t[", t->osd, t->pgid.pool, t->pgid.seed);
153 for (i = 0; i < t->up.size; i++)
154 seq_printf(s, "%s%d", (!i ? "" : ","), t->up.osds[i]);
155 seq_printf(s, "]/%d\t[", t->up.primary);
156 for (i = 0; i < t->acting.size; i++)
157 seq_printf(s, "%s%d", (!i ? "" : ","), t->acting.osds[i]);
158 seq_printf(s, "]/%d\t%*pE\t0x%x", t->acting.primary,
159 t->target_oid.name_len, t->target_oid.name, t->flags);
160 if (t->paused)
161 seq_puts(s, "\tP");
162}
163
164static void dump_request(struct seq_file *s, struct ceph_osd_request *req)
165{
166 int i;
167
168 seq_printf(s, "%llu\t", req->r_tid);
169 dump_target(s, &req->r_t);
170
171 seq_printf(s, "\t%d\t%u'%llu", req->r_attempts,
172 le32_to_cpu(req->r_replay_version.epoch),
173 le64_to_cpu(req->r_replay_version.version));
174
175 for (i = 0; i < req->r_num_ops; i++) {
176 struct ceph_osd_req_op *op = &req->r_ops[i];
177
178 seq_printf(s, "%s%s", (i == 0 ? "\t" : ","),
179 ceph_osd_op_name(op->op));
180 }
181
182 seq_putc(s, '\n');
183}
184
148static int osdc_show(struct seq_file *s, void *pp) 185static int osdc_show(struct seq_file *s, void *pp)
149{ 186{
150 struct ceph_client *client = s->private; 187 struct ceph_client *client = s->private;
@@ -154,32 +191,10 @@ static int osdc_show(struct seq_file *s, void *pp)
154 mutex_lock(&osdc->request_mutex); 191 mutex_lock(&osdc->request_mutex);
155 for (p = rb_first(&osdc->requests); p; p = rb_next(p)) { 192 for (p = rb_first(&osdc->requests); p; p = rb_next(p)) {
156 struct ceph_osd_request *req; 193 struct ceph_osd_request *req;
157 unsigned int i;
158 int opcode;
159 194
160 req = rb_entry(p, struct ceph_osd_request, r_node); 195 req = rb_entry(p, struct ceph_osd_request, r_node);
161 196
162 seq_printf(s, "%lld\tosd%d\t%lld.%x\t", req->r_tid, 197 dump_request(s, req);
163 req->r_osd ? req->r_osd->o_osd : -1,
164 req->r_t.pgid.pool, req->r_t.pgid.seed);
165
166 seq_printf(s, "%*pE", req->r_base_oid.name_len,
167 req->r_base_oid.name);
168
169 if (req->r_reassert_version.epoch)
170 seq_printf(s, "\t%u'%llu",
171 (unsigned int)le32_to_cpu(req->r_reassert_version.epoch),
172 le64_to_cpu(req->r_reassert_version.version));
173 else
174 seq_printf(s, "\t");
175
176 for (i = 0; i < req->r_num_ops; i++) {
177 opcode = req->r_ops[i].op;
178 seq_printf(s, "%s%s", (i == 0 ? "\t" : ","),
179 ceph_osd_op_name(opcode));
180 }
181
182 seq_printf(s, "\n");
183 } 198 }
184 mutex_unlock(&osdc->request_mutex); 199 mutex_unlock(&osdc->request_mutex);
185 return 0; 200 return 0;