int librados::IoCtxImpl::aio_read(const object_t oid, AioCompletionImpl *c,
bufferlist *pbl, size_t len, uint64_t off,
- uint64_t snapid)
+ uint64_t snapid, const blkin_trace_info *info)
{
FUNCTRACE();
if (len > (size_t) INT_MAX)
c->io = this;
c->blp = pbl;
+ ZTracer::Trace trace;
+ if (info)
+ trace.init("rados read", &objecter->trace_endpoint, info);
+
Objecter::Op *o = objecter->prepare_read_op(
oid, oloc,
off, len, snapid, pbl, 0,
- oncomplete, &c->objver);
+ oncomplete, &c->objver, nullptr, 0, &trace);
objecter->op_submit(o, &c->tid);
return 0;
}
int librados::IoCtxImpl::aio_read(const object_t oid, AioCompletionImpl *c,
char *buf, size_t len, uint64_t off,
- uint64_t snapid)
+ uint64_t snapid, const blkin_trace_info *info)
{
FUNCTRACE();
if (len > (size_t) INT_MAX)
c->blp = &c->bl;
c->out_buf = buf;
+ ZTracer::Trace trace;
+ if (info)
+ trace.init("rados read", &objecter->trace_endpoint, info);
+
Objecter::Op *o = objecter->prepare_read_op(
oid, oloc,
off, len, snapid, &c->bl, 0,
- oncomplete, &c->objver);
+ oncomplete, &c->objver, nullptr, 0, &trace);
objecter->op_submit(o, &c->tid);
return 0;
}
int librados::IoCtxImpl::aio_write(const object_t &oid, AioCompletionImpl *c,
const bufferlist& bl, size_t len,
- uint64_t off)
+ uint64_t off, const blkin_trace_info *info)
{
FUNCTRACE();
auto ut = ceph::real_clock::now();
#if defined(WITH_LTTNG) && defined(WITH_EVENTTRACE)
((C_aio_Complete *) oncomplete)->oid = oid;
#endif
+ ZTracer::Trace trace;
+ if (info)
+ trace.init("rados write", &objecter->trace_endpoint, info);
+
c->io = this;
queue_aio_write(c);
Objecter::Op *o = objecter->prepare_write_op(
oid, oloc,
off, len, snapc, bl, ut, 0,
- oncomplete, &c->objver);
+ oncomplete, &c->objver, nullptr, 0, &trace);
objecter->op_submit(o, &c->tid);
return 0;
#include "common/Cond.h"
#include "common/Mutex.h"
#include "common/snap_types.h"
+#include "common/zipkin_trace.h"
#include "include/atomic.h"
#include "include/types.h"
#include "include/rados/librados.h"
};
int aio_read(const object_t oid, AioCompletionImpl *c,
- bufferlist *pbl, size_t len, uint64_t off, uint64_t snapid);
+ bufferlist *pbl, size_t len, uint64_t off, uint64_t snapid,
+ const blkin_trace_info *info = nullptr);
int aio_read(object_t oid, AioCompletionImpl *c,
- char *buf, size_t len, uint64_t off, uint64_t snapid);
+ char *buf, size_t len, uint64_t off, uint64_t snapid,
+ const blkin_trace_info *info = nullptr);
int aio_sparse_read(const object_t oid, AioCompletionImpl *c,
std::map<uint64_t,uint64_t> *m, bufferlist *data_bl,
size_t len, uint64_t off, uint64_t snapid);
int aio_cmpext(const object_t& oid, AioCompletionImpl *c,
const char *cmp_buf, size_t cmp_len, uint64_t off);
int aio_write(const object_t &oid, AioCompletionImpl *c,
- const bufferlist& bl, size_t len, uint64_t off);
+ const bufferlist& bl, size_t len, uint64_t off,
+ const blkin_trace_info *info = nullptr);
int aio_append(const object_t &oid, AioCompletionImpl *c,
const bufferlist& bl, size_t len);
int aio_write_full(const object_t &oid, AioCompletionImpl *c,
return retval;
}
+#ifdef WITH_BLKIN
+extern "C" int rados_aio_read_traced(rados_ioctx_t io, const char *o,
+ rados_completion_t completion,
+ char *buf, size_t len, uint64_t off,
+ struct blkin_trace_info *info)
+{
+ tracepoint(librados, rados_aio_read_enter, io, o, completion, len, off);
+ librados::IoCtxImpl *ctx = (librados::IoCtxImpl *)io;
+ object_t oid(o);
+ int retval = ctx->aio_read(oid, (librados::AioCompletionImpl*)completion,
+ buf, len, off, ctx->snap_seq, info);
+ tracepoint(librados, rados_aio_read_exit, retval);
+ return retval;
+}
+#endif
+
extern "C" int rados_aio_write(rados_ioctx_t io, const char *o,
rados_completion_t completion,
const char *buf, size_t len, uint64_t off)
return retval;
}
+#ifdef WITH_BLKIN
+extern "C" int rados_aio_write_traced(rados_ioctx_t io, const char *o,
+ rados_completion_t completion,
+ const char *buf, size_t len, uint64_t off,
+ struct blkin_trace_info *info)
+{
+ tracepoint(librados, rados_aio_write_enter, io, o, completion, buf, len, off);
+ if (len > UINT_MAX/2)
+ return -E2BIG;
+ librados::IoCtxImpl *ctx = (librados::IoCtxImpl *)io;
+ object_t oid(o);
+ bufferlist bl;
+ bl.append(buf, len);
+ int retval = ctx->aio_write(oid, (librados::AioCompletionImpl*)completion,
+ bl, len, off, info);
+ tracepoint(librados, rados_aio_write_exit, retval);
+ return retval;
+}
+#endif
+
extern "C" int rados_aio_append(rados_ioctx_t io, const char *o,
rados_completion_t completion,
const char *buf, size_t len)
m->ops = op->ops;
m->set_mtime(op->mtime);
m->set_retry_attempt(op->attempts++);
+ m->trace = op->trace;
if (op->priority)
m->set_priority(op->priority);
#include "common/ceph_timer.h"
#include "common/Finisher.h"
#include "common/shunique_lock.h"
+#include "common/zipkin_trace.h"
#include "messages/MOSDOp.h"
#include "osd/OSDMap.h"
-
using namespace std;
class Context;
Messenger *messenger;
MonClient *monc;
Finisher *finisher;
+ ZTracer::Endpoint trace_endpoint;
private:
OSDMap *osdmap;
public:
int *data_offset;
osd_reqid_t reqid; // explicitly setting reqid
+ ZTracer::Trace trace;
Op(const object_t& o, const object_locator_t& ol, vector<OSDOp>& op,
- int f, Context *fin, version_t *ov, int *offset = NULL) :
+ int f, Context *fin, version_t *ov, int *offset = NULL,
+ ZTracer::Trace *parent_trace = nullptr) :
session(NULL), incarnation(0),
target(o, ol, f),
con(NULL),
if (target.base_oloc.key == o)
target.base_oloc.key.clear();
+
+ if (parent_trace && parent_trace->valid())
+ trace.init("op", nullptr, parent_trace);
}
bool operator<(const Op& other) const {
double mon_timeout,
double osd_timeout) :
Dispatcher(cct_), messenger(m), monc(mc), finisher(fin),
+ trace_endpoint("0.0.0.0", 0, "Objecter"),
osdmap(new OSDMap), initialized(0), last_tid(0), client_inc(-1),
max_linger_id(0), num_in_flight(0), global_op_flags(0),
keep_balanced_budget(false), honor_osdmap_full(true), osdmap_full_try(false),
const object_t& oid, const object_locator_t& oloc,
uint64_t off, uint64_t len, snapid_t snap, bufferlist *pbl,
int flags, Context *onfinish, version_t *objver = NULL,
- ObjectOperation *extra_ops = NULL, int op_flags = 0) {
+ ObjectOperation *extra_ops = NULL, int op_flags = 0,
+ ZTracer::Trace *parent_trace = nullptr) {
vector<OSDOp> ops;
int i = init_ops(ops, 1, extra_ops);
ops[i].op.op = CEPH_OSD_OP_READ;
ops[i].op.extent.truncate_seq = 0;
ops[i].op.flags = op_flags;
Op *o = new Op(oid, oloc, ops, flags | global_op_flags.read() |
- CEPH_OSD_FLAG_READ, onfinish, objver);
+ CEPH_OSD_FLAG_READ, onfinish, objver, nullptr, parent_trace);
o->snapid = snap;
o->outbl = pbl;
return o;
uint64_t off, uint64_t len, const SnapContext& snapc,
const bufferlist &bl, ceph::real_time mtime, int flags,
Context *oncommit, version_t *objver = NULL,
- ObjectOperation *extra_ops = NULL, int op_flags = 0) {
+ ObjectOperation *extra_ops = NULL, int op_flags = 0,
+ ZTracer::Trace *parent_trace = nullptr) {
vector<OSDOp> ops;
int i = init_ops(ops, 1, extra_ops);
ops[i].op.op = CEPH_OSD_OP_WRITE;
ops[i].indata = bl;
ops[i].op.flags = op_flags;
Op *o = new Op(oid, oloc, ops, flags | global_op_flags.read() |
- CEPH_OSD_FLAG_WRITE, oncommit, objver);
+ CEPH_OSD_FLAG_WRITE, oncommit, objver,
+ nullptr, parent_trace);
o->mtime = mtime;
o->snapc = snapc;
return o;