mirror of
https://github.com/ceph/ceph
synced 2025-02-23 02:57:21 +00:00
lttng: Add more tracing to librbd
Includes: - aio_complete - aio_discard - aio_flush - aio_get_return_value - aio_is_complete - aio_read - aio_wait_for_complete - aio_write - copy - discard - flush - invalidate_cache - rename - resize - Add ImageCtx pointer to trace points - Add snap_name and readonly flag to trace point open_image_enter Signed-off-by: Adam Crume <adamcrume@gmail.com>
This commit is contained in:
parent
e9b39d918f
commit
f625775872
@ -10,6 +10,7 @@
|
||||
#include "librbd/internal.h"
|
||||
|
||||
#include "librbd/AioCompletion.h"
|
||||
#include "tracing/librbd.h"
|
||||
|
||||
#define dout_subsys ceph_subsys_rbd
|
||||
#undef dout_prefix
|
||||
@ -30,6 +31,16 @@ namespace librbd {
|
||||
lock.Unlock();
|
||||
}
|
||||
|
||||
int AioCompletion::wait_for_complete() {
|
||||
tracepoint(librbd, aio_wait_for_complete_enter, this);
|
||||
lock.Lock();
|
||||
while (!done)
|
||||
cond.Wait(lock);
|
||||
lock.Unlock();
|
||||
tracepoint(librbd, aio_wait_for_complete_exit, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AioCompletion::finalize(CephContext *cct, ssize_t rval)
|
||||
{
|
||||
ldout(cct, 20) << "AioCompletion::finalize() " << (void*)this << " rval " << rval << " read_buf " << (void*)read_buf
|
||||
@ -54,6 +65,32 @@ namespace librbd {
|
||||
}
|
||||
}
|
||||
|
||||
void AioCompletion::complete() {
|
||||
tracepoint(librbd, aio_complete_enter, this, rval);
|
||||
utime_t elapsed;
|
||||
assert(lock.is_locked());
|
||||
elapsed = ceph_clock_now(ictx->cct) - start_time;
|
||||
switch (aio_type) {
|
||||
case AIO_TYPE_READ:
|
||||
ictx->perfcounter->tinc(l_librbd_aio_rd_latency, elapsed); break;
|
||||
case AIO_TYPE_WRITE:
|
||||
ictx->perfcounter->tinc(l_librbd_aio_wr_latency, elapsed); break;
|
||||
case AIO_TYPE_DISCARD:
|
||||
ictx->perfcounter->tinc(l_librbd_aio_discard_latency, elapsed); break;
|
||||
case AIO_TYPE_FLUSH:
|
||||
ictx->perfcounter->tinc(l_librbd_aio_flush_latency, elapsed); break;
|
||||
default:
|
||||
lderr(ictx->cct) << "completed invalid aio_type: " << aio_type << dendl;
|
||||
break;
|
||||
}
|
||||
if (complete_cb) {
|
||||
complete_cb(rbd_comp, complete_arg);
|
||||
}
|
||||
done = true;
|
||||
cond.Signal();
|
||||
tracepoint(librbd, aio_complete_exit);
|
||||
}
|
||||
|
||||
void AioCompletion::complete_request(CephContext *cct, ssize_t r)
|
||||
{
|
||||
ldout(cct, 20) << "AioCompletion::complete_request() "
|
||||
@ -75,6 +112,26 @@ namespace librbd {
|
||||
put_unlock();
|
||||
}
|
||||
|
||||
bool AioCompletion::is_complete() {
|
||||
tracepoint(librbd, aio_is_complete_enter, this);
|
||||
bool done;
|
||||
{
|
||||
Mutex::Locker l(lock);
|
||||
done = this->done;
|
||||
}
|
||||
tracepoint(librbd, aio_is_complete_exit, done);
|
||||
return done;
|
||||
}
|
||||
|
||||
ssize_t AioCompletion::get_return_value() {
|
||||
tracepoint(librbd, aio_get_return_value_enter, this);
|
||||
lock.Lock();
|
||||
ssize_t r = rval;
|
||||
lock.Unlock();
|
||||
tracepoint(librbd, aio_get_return_value_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
void C_AioRead::finish(int r)
|
||||
{
|
||||
ldout(m_cct, 10) << "C_AioRead::finish() " << this << " r = " << r << dendl;
|
||||
|
@ -72,13 +72,7 @@ namespace librbd {
|
||||
~AioCompletion() {
|
||||
}
|
||||
|
||||
int wait_for_complete() {
|
||||
lock.Lock();
|
||||
while (!done)
|
||||
cond.Wait(lock);
|
||||
lock.Unlock();
|
||||
return 0;
|
||||
}
|
||||
int wait_for_complete();
|
||||
|
||||
void add_request() {
|
||||
lock.Lock();
|
||||
@ -97,29 +91,7 @@ namespace librbd {
|
||||
start_time = ceph_clock_now(ictx->cct);
|
||||
}
|
||||
|
||||
void complete() {
|
||||
utime_t elapsed;
|
||||
assert(lock.is_locked());
|
||||
elapsed = ceph_clock_now(ictx->cct) - start_time;
|
||||
switch (aio_type) {
|
||||
case AIO_TYPE_READ:
|
||||
ictx->perfcounter->tinc(l_librbd_aio_rd_latency, elapsed); break;
|
||||
case AIO_TYPE_WRITE:
|
||||
ictx->perfcounter->tinc(l_librbd_aio_wr_latency, elapsed); break;
|
||||
case AIO_TYPE_DISCARD:
|
||||
ictx->perfcounter->tinc(l_librbd_aio_discard_latency, elapsed); break;
|
||||
case AIO_TYPE_FLUSH:
|
||||
ictx->perfcounter->tinc(l_librbd_aio_flush_latency, elapsed); break;
|
||||
default:
|
||||
lderr(ictx->cct) << "completed invalid aio_type: " << aio_type << dendl;
|
||||
break;
|
||||
}
|
||||
if (complete_cb) {
|
||||
complete_cb(rbd_comp, complete_arg);
|
||||
}
|
||||
done = true;
|
||||
cond.Signal();
|
||||
}
|
||||
void complete();
|
||||
|
||||
void set_complete_cb(void *cb_arg, callback_t cb) {
|
||||
complete_cb = cb;
|
||||
@ -128,17 +100,9 @@ namespace librbd {
|
||||
|
||||
void complete_request(CephContext *cct, ssize_t r);
|
||||
|
||||
bool is_complete() {
|
||||
Mutex::Locker l(lock);
|
||||
return done;
|
||||
}
|
||||
bool is_complete();
|
||||
|
||||
ssize_t get_return_value() {
|
||||
lock.Lock();
|
||||
ssize_t r = rval;
|
||||
lock.Unlock();
|
||||
return r;
|
||||
}
|
||||
ssize_t get_return_value();
|
||||
|
||||
void get() {
|
||||
lock.Lock();
|
||||
|
@ -1075,6 +1075,7 @@ reprotect_and_return_err:
|
||||
|
||||
int rename(IoCtx& io_ctx, const char *srcname, const char *dstname)
|
||||
{
|
||||
tracepoint(librbd, rename_enter, io_ctx.get_pool_name().c_str(), io_ctx.get_id(), srcname, dstname);
|
||||
CephContext *cct = (CephContext *)io_ctx.cct();
|
||||
ldout(cct, 20) << "rename " << &io_ctx << " " << srcname << " -> "
|
||||
<< dstname << dendl;
|
||||
@ -1097,6 +1098,7 @@ reprotect_and_return_err:
|
||||
r = cls_client::get_id(&io_ctx, src_oid, &id);
|
||||
if (r < 0) {
|
||||
lderr(cct) << "error reading image id: " << cpp_strerror(r) << dendl;
|
||||
tracepoint(librbd, rename_exit, r);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
@ -1107,6 +1109,7 @@ reprotect_and_return_err:
|
||||
if (r < 0) {
|
||||
lderr(cct) << "error reading source object: " << src_oid << ": "
|
||||
<< cpp_strerror(r) << dendl;
|
||||
tracepoint(librbd, rename_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -1118,6 +1121,7 @@ reprotect_and_return_err:
|
||||
if (r < 0) {
|
||||
lderr(cct) << "error reading source object omap values: "
|
||||
<< cpp_strerror(r) << dendl;
|
||||
tracepoint(librbd, rename_exit, r);
|
||||
return r;
|
||||
}
|
||||
omap_values.insert(outbl.begin(), outbl.end());
|
||||
@ -1129,10 +1133,12 @@ reprotect_and_return_err:
|
||||
if (r < 0 && r != -ENOENT) {
|
||||
lderr(cct) << "error checking for existing image called "
|
||||
<< dstname << ":" << cpp_strerror(r) << dendl;
|
||||
tracepoint(librbd, rename_exit, r);
|
||||
return r;
|
||||
}
|
||||
if (r == 0) {
|
||||
lderr(cct) << "rbd image " << dstname << " already exists" << dendl;
|
||||
tracepoint(librbd, rename_exit, -EEXIST);
|
||||
return -EEXIST;
|
||||
}
|
||||
|
||||
@ -1145,6 +1151,7 @@ reprotect_and_return_err:
|
||||
if (r < 0) {
|
||||
lderr(cct) << "error writing destination object: " << dst_oid << ": "
|
||||
<< cpp_strerror(r) << dendl;
|
||||
tracepoint(librbd, rename_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -1154,6 +1161,7 @@ reprotect_and_return_err:
|
||||
io_ctx.remove(dst_oid);
|
||||
lderr(cct) << "couldn't add " << dstname << " to directory: "
|
||||
<< cpp_strerror(r) << dendl;
|
||||
tracepoint(librbd, rename_exit, r);
|
||||
return r;
|
||||
}
|
||||
r = tmap_rm(io_ctx, srcname);
|
||||
@ -1166,6 +1174,7 @@ reprotect_and_return_err:
|
||||
srcname, dstname, id);
|
||||
if (r < 0) {
|
||||
lderr(cct) << "error updating directory: " << cpp_strerror(r) << dendl;
|
||||
tracepoint(librbd, rename_exit, r);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
@ -1180,6 +1189,7 @@ reprotect_and_return_err:
|
||||
notify_change(io_ctx, old_header_name(srcname), NULL, NULL);
|
||||
}
|
||||
|
||||
tracepoint(librbd, rename_exit, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1530,30 +1540,38 @@ reprotect_and_return_err:
|
||||
|
||||
int resize(ImageCtx *ictx, uint64_t size, ProgressContext& prog_ctx)
|
||||
{
|
||||
tracepoint(librbd, resize_enter, ictx, ictx->name.c_str(), ictx->id.c_str(), size);
|
||||
CephContext *cct = ictx->cct;
|
||||
ldout(cct, 20) << "resize " << ictx << " " << ictx->size << " -> "
|
||||
<< size << dendl;
|
||||
|
||||
if (ictx->read_only)
|
||||
if (ictx->read_only) {
|
||||
tracepoint(librbd, resize_exit, -EROFS);
|
||||
return -EROFS;
|
||||
}
|
||||
|
||||
int r = ictx_check(ictx);
|
||||
if (r < 0)
|
||||
if (r < 0) {
|
||||
tracepoint(librbd, resize_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
RWLock::WLocker l(ictx->md_lock);
|
||||
if (size < ictx->size && ictx->object_cacher) {
|
||||
// need to invalidate since we're deleting objects, and
|
||||
// ObjectCacher doesn't track non-existent objects
|
||||
r = ictx->invalidate_cache();
|
||||
if (r < 0)
|
||||
if (r < 0) {
|
||||
tracepoint(librbd, resize_exit, r);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
resize_helper(ictx, size, prog_ctx);
|
||||
|
||||
ldout(cct, 2) << "done." << dendl;
|
||||
|
||||
ictx->perfcounter->inc(l_librbd_resize);
|
||||
tracepoint(librbd, resize_exit, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2027,6 +2045,7 @@ reprotect_and_return_err:
|
||||
|
||||
int copy(ImageCtx *src, ImageCtx *dest, ProgressContext &prog_ctx)
|
||||
{
|
||||
tracepoint(librbd, copy_enter, src, src->name.c_str(), src->id.c_str(), dest, dest->name.c_str(), dest->id.c_str());
|
||||
src->md_lock.get_read();
|
||||
src->snap_lock.get_read();
|
||||
uint64_t src_size = src->get_image_size(src->snap_id);
|
||||
@ -2043,6 +2062,7 @@ reprotect_and_return_err:
|
||||
if (dest_size < src_size) {
|
||||
lderr(cct) << " src size " << src_size << " >= dest size "
|
||||
<< dest_size << dendl;
|
||||
tracepoint(librbd, copy_exit, -EINVAL);
|
||||
return -EINVAL;
|
||||
}
|
||||
int r;
|
||||
@ -2061,6 +2081,7 @@ reprotect_and_return_err:
|
||||
lderr(cct) << "could not read from source image from "
|
||||
<< offset << " to " << offset + len << ": "
|
||||
<< cpp_strerror(r) << dendl;
|
||||
tracepoint(librbd, copy_exit, r);
|
||||
return r;
|
||||
}
|
||||
prog_ctx.update_progress(offset, src_size);
|
||||
@ -2069,6 +2090,7 @@ reprotect_and_return_err:
|
||||
r = throttle.wait_for_ret();
|
||||
if (r >= 0)
|
||||
prog_ctx.update_progress(src_size, src_size);
|
||||
tracepoint(librbd, copy_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -2110,7 +2132,7 @@ reprotect_and_return_err:
|
||||
|
||||
int open_image(ImageCtx *ictx)
|
||||
{
|
||||
tracepoint(librbd, open_image_enter, ictx->name.c_str(), ictx->id.c_str());
|
||||
tracepoint(librbd, open_image_enter, ictx, ictx->name.c_str(), ictx->id.c_str(), ictx->snap_name.c_str(), ictx->read_only);
|
||||
ldout(ictx->cct, 20) << "open_image: ictx = " << ictx
|
||||
<< " name = '" << ictx->name
|
||||
<< "' id = '" << ictx->id
|
||||
@ -2149,7 +2171,7 @@ reprotect_and_return_err:
|
||||
|
||||
void close_image(ImageCtx *ictx)
|
||||
{
|
||||
tracepoint(librbd, close_image_enter, ictx->name.c_str(), ictx->id.c_str());
|
||||
tracepoint(librbd, close_image_enter, ictx, ictx->name.c_str(), ictx->id.c_str());
|
||||
ldout(ictx->cct, 20) << "close_image " << ictx << dendl;
|
||||
if (ictx->object_cacher)
|
||||
ictx->shutdown_cache(); // implicitly flushes
|
||||
@ -2666,7 +2688,7 @@ reprotect_and_return_err:
|
||||
|
||||
ssize_t read(ImageCtx *ictx, const vector<pair<uint64_t,uint64_t> >& image_extents, char *buf, bufferlist *pbl)
|
||||
{
|
||||
tracepoint(librbd, read_enter, ictx->name.c_str(), ictx->id.c_str());
|
||||
tracepoint(librbd, read_enter, ictx, ictx->name.c_str(), ictx->id.c_str());
|
||||
for (vector<pair<uint64_t,uint64_t> >::const_iterator r = image_extents.begin();
|
||||
r != image_extents.end();
|
||||
++r) {
|
||||
@ -2698,7 +2720,7 @@ reprotect_and_return_err:
|
||||
|
||||
ssize_t write(ImageCtx *ictx, uint64_t off, size_t len, const char *buf)
|
||||
{
|
||||
tracepoint(librbd, write_enter, ictx->name.c_str(), ictx->id.c_str(), off, len, buf);
|
||||
tracepoint(librbd, write_enter, ictx, ictx->name.c_str(), ictx->id.c_str(), off, len, buf);
|
||||
utime_t start_time, elapsed;
|
||||
ldout(ictx->cct, 20) << "write " << ictx << " off = " << off << " len = "
|
||||
<< len << dendl;
|
||||
@ -2746,6 +2768,7 @@ reprotect_and_return_err:
|
||||
|
||||
int discard(ImageCtx *ictx, uint64_t off, uint64_t len)
|
||||
{
|
||||
tracepoint(librbd, discard_enter, ictx, ictx->name.c_str(), ictx->id.c_str(), off, len);
|
||||
utime_t start_time, elapsed;
|
||||
ldout(ictx->cct, 20) << "discard " << ictx << " off = " << off << " len = "
|
||||
<< len << dendl;
|
||||
@ -2762,6 +2785,7 @@ reprotect_and_return_err:
|
||||
if (r < 0) {
|
||||
c->release();
|
||||
delete ctx;
|
||||
tracepoint(librbd, discard_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -2770,13 +2794,16 @@ reprotect_and_return_err:
|
||||
cond.Wait(mylock);
|
||||
mylock.Unlock();
|
||||
|
||||
if (ret < 0)
|
||||
if (ret < 0) {
|
||||
tracepoint(librbd, discard_exit, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
elapsed = ceph_clock_now(ictx->cct) - start_time;
|
||||
ictx->perfcounter->inc(l_librbd_discard_latency, elapsed);
|
||||
ictx->perfcounter->inc(l_librbd_discard);
|
||||
ictx->perfcounter->inc(l_librbd_discard_bytes, len);
|
||||
tracepoint(librbd, discard_exit, len);
|
||||
return len;
|
||||
}
|
||||
|
||||
@ -2883,12 +2910,15 @@ reprotect_and_return_err:
|
||||
|
||||
int aio_flush(ImageCtx *ictx, AioCompletion *c)
|
||||
{
|
||||
tracepoint(librbd, aio_flush_enter, ictx, ictx->name.c_str(), ictx->id.c_str(), c);
|
||||
CephContext *cct = ictx->cct;
|
||||
ldout(cct, 20) << "aio_flush " << ictx << " completion " << c << dendl;
|
||||
|
||||
int r = ictx_check(ictx);
|
||||
if (r < 0)
|
||||
if (r < 0) {
|
||||
tracepoint(librbd, aio_flush_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
ictx->user_flushed();
|
||||
|
||||
@ -2908,21 +2938,26 @@ reprotect_and_return_err:
|
||||
c->put();
|
||||
ictx->perfcounter->inc(l_librbd_aio_flush);
|
||||
|
||||
tracepoint(librbd, aio_flush_exit, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int flush(ImageCtx *ictx)
|
||||
{
|
||||
tracepoint(librbd, flush_enter, ictx, ictx->name.c_str(), ictx->id.c_str());
|
||||
CephContext *cct = ictx->cct;
|
||||
ldout(cct, 20) << "flush " << ictx << dendl;
|
||||
|
||||
int r = ictx_check(ictx);
|
||||
if (r < 0)
|
||||
if (r < 0) {
|
||||
tracepoint(librbd, flush_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
ictx->user_flushed();
|
||||
r = _flush(ictx);
|
||||
ictx->perfcounter->inc(l_librbd_flush);
|
||||
tracepoint(librbd, flush_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -2945,32 +2980,42 @@ reprotect_and_return_err:
|
||||
|
||||
int invalidate_cache(ImageCtx *ictx)
|
||||
{
|
||||
tracepoint(librbd, invalidate_cache_enter, ictx, ictx->name.c_str(), ictx->id.c_str());
|
||||
CephContext *cct = ictx->cct;
|
||||
ldout(cct, 20) << "invalidate_cache " << ictx << dendl;
|
||||
|
||||
int r = ictx_check(ictx);
|
||||
if (r < 0)
|
||||
if (r < 0) {
|
||||
tracepoint(librbd, invalidate_cache_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
RWLock::WLocker l(ictx->md_lock);
|
||||
return ictx->invalidate_cache();
|
||||
r = ictx->invalidate_cache();
|
||||
tracepoint(librbd, invalidate_cache_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
int aio_write(ImageCtx *ictx, uint64_t off, size_t len, const char *buf,
|
||||
AioCompletion *c)
|
||||
{
|
||||
tracepoint(librbd, aio_write_enter, ictx, ictx->name.c_str(), ictx->id.c_str(), off, len, buf, c);
|
||||
CephContext *cct = ictx->cct;
|
||||
ldout(cct, 20) << "aio_write " << ictx << " off = " << off << " len = "
|
||||
<< len << " buf = " << (void*)buf << dendl;
|
||||
|
||||
int r = ictx_check(ictx);
|
||||
if (r < 0)
|
||||
if (r < 0) {
|
||||
tracepoint(librbd, aio_write_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
uint64_t mylen = len;
|
||||
r = clip_io(ictx, off, &mylen);
|
||||
if (r < 0)
|
||||
if (r < 0) {
|
||||
tracepoint(librbd, aio_write_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
ictx->snap_lock.get_read();
|
||||
snapid_t snap_id = ictx->snap_id;
|
||||
@ -2981,8 +3026,10 @@ reprotect_and_return_err:
|
||||
ictx->parent_lock.put_read();
|
||||
ictx->snap_lock.put_read();
|
||||
|
||||
if (snap_id != CEPH_NOSNAP || ictx->read_only)
|
||||
if (snap_id != CEPH_NOSNAP || ictx->read_only) {
|
||||
tracepoint(librbd, aio_write_exit, -EROFS);
|
||||
return -EROFS;
|
||||
}
|
||||
|
||||
ldout(cct, 20) << " parent overlap " << overlap << dendl;
|
||||
|
||||
@ -3035,22 +3082,28 @@ reprotect_and_return_err:
|
||||
ictx->perfcounter->inc(l_librbd_aio_wr_bytes, mylen);
|
||||
|
||||
/* FIXME: cleanup all the allocated stuff */
|
||||
tracepoint(librbd, aio_write_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
int aio_discard(ImageCtx *ictx, uint64_t off, uint64_t len, AioCompletion *c)
|
||||
{
|
||||
tracepoint(librbd, aio_discard_enter, ictx, ictx->name.c_str(), ictx->id.c_str(), off, len, c);
|
||||
CephContext *cct = ictx->cct;
|
||||
ldout(cct, 20) << "aio_discard " << ictx << " off = " << off << " len = "
|
||||
<< len << dendl;
|
||||
|
||||
int r = ictx_check(ictx);
|
||||
if (r < 0)
|
||||
if (r < 0) {
|
||||
tracepoint(librbd, aio_discard_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
r = clip_io(ictx, off, &len);
|
||||
if (r < 0)
|
||||
if (r < 0) {
|
||||
tracepoint(librbd, aio_discard_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
// TODO: check for snap
|
||||
ictx->snap_lock.get_read();
|
||||
@ -3062,8 +3115,10 @@ reprotect_and_return_err:
|
||||
ictx->parent_lock.put_read();
|
||||
ictx->snap_lock.put_read();
|
||||
|
||||
if (snap_id != CEPH_NOSNAP || ictx->read_only)
|
||||
if (snap_id != CEPH_NOSNAP || ictx->read_only) {
|
||||
tracepoint(librbd, aio_discard_exit, -EROFS);
|
||||
return -EROFS;
|
||||
}
|
||||
|
||||
// map
|
||||
vector<ObjectExtent> extents;
|
||||
@ -3121,6 +3176,7 @@ reprotect_and_return_err:
|
||||
ictx->perfcounter->inc(l_librbd_aio_discard_bytes, len);
|
||||
|
||||
/* FIXME: cleanup all the allocated stuff */
|
||||
tracepoint(librbd, aio_discard_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -3143,11 +3199,19 @@ reprotect_and_return_err:
|
||||
int aio_read(ImageCtx *ictx, const vector<pair<uint64_t,uint64_t> >& image_extents,
|
||||
char *buf, bufferlist *pbl, AioCompletion *c)
|
||||
{
|
||||
tracepoint(librbd, aio_read_enter, ictx, ictx->name.c_str(), ictx->id.c_str(), buf, c);
|
||||
for (vector<pair<uint64_t,uint64_t> >::const_iterator r = image_extents.begin();
|
||||
r != image_extents.end();
|
||||
++r) {
|
||||
tracepoint(librbd, aio_read_extent, r->first, r->second);
|
||||
}
|
||||
ldout(ictx->cct, 20) << "aio_read " << ictx << " completion " << c << " " << image_extents << dendl;
|
||||
|
||||
int r = ictx_check(ictx);
|
||||
if (r < 0)
|
||||
if (r < 0) {
|
||||
tracepoint(librbd, aio_read_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
ictx->snap_lock.get_read();
|
||||
snap_t snap_id = ictx->snap_id;
|
||||
@ -3162,8 +3226,10 @@ reprotect_and_return_err:
|
||||
++p) {
|
||||
uint64_t len = p->second;
|
||||
r = clip_io(ictx, p->first, &len);
|
||||
if (r < 0)
|
||||
if (r < 0) {
|
||||
tracepoint(librbd, aio_read_exit, r);
|
||||
return r;
|
||||
}
|
||||
if (len == 0)
|
||||
continue;
|
||||
|
||||
@ -3217,6 +3283,7 @@ reprotect_and_return_err:
|
||||
ictx->perfcounter->inc(l_librbd_aio_rd);
|
||||
ictx->perfcounter->inc(l_librbd_aio_rd_bytes, buffer_ofs);
|
||||
|
||||
tracepoint(librbd, aio_read_exit, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -3,9 +3,11 @@
|
||||
|
||||
TRACEPOINT_EVENT(librbd, read_enter,
|
||||
TP_ARGS(
|
||||
void*, imagectx,
|
||||
const char*, name,
|
||||
const char*, id),
|
||||
TP_FIELDS(
|
||||
ctf_integer_hex(void*, imagectx, imagectx)
|
||||
ctf_string(name, name)
|
||||
ctf_string(id, id)
|
||||
)
|
||||
@ -31,12 +33,14 @@ TRACEPOINT_EVENT(librbd, read_exit,
|
||||
|
||||
TRACEPOINT_EVENT(librbd, write_enter,
|
||||
TP_ARGS(
|
||||
void*, imagectx,
|
||||
const char*, name,
|
||||
const char*, id,
|
||||
uint64_t, off,
|
||||
size_t, len,
|
||||
const char*, buf),
|
||||
TP_FIELDS(
|
||||
ctf_integer_hex(void*, imagectx, imagectx)
|
||||
ctf_string(name, name)
|
||||
ctf_string(id, id)
|
||||
ctf_integer(uint64_t, off, off)
|
||||
@ -54,11 +58,17 @@ TRACEPOINT_EVENT(librbd, write_exit,
|
||||
|
||||
TRACEPOINT_EVENT(librbd, open_image_enter,
|
||||
TP_ARGS(
|
||||
void*, imagectx,
|
||||
const char*, name,
|
||||
const char*, id),
|
||||
const char*, id,
|
||||
const char*, snap_name,
|
||||
int, read_only),
|
||||
TP_FIELDS(
|
||||
ctf_integer_hex(void*, imagectx, imagectx)
|
||||
ctf_string(name, name)
|
||||
ctf_string(id, id)
|
||||
ctf_string(snap_name, snap_name)
|
||||
ctf_integer(uint8_t, read_only, read_only ? 1 : 0)
|
||||
)
|
||||
)
|
||||
|
||||
@ -72,9 +82,11 @@ TRACEPOINT_EVENT(librbd, open_image_exit,
|
||||
|
||||
TRACEPOINT_EVENT(librbd, close_image_enter,
|
||||
TP_ARGS(
|
||||
void*, imagectx,
|
||||
const char*, name,
|
||||
const char*, id),
|
||||
TP_FIELDS(
|
||||
ctf_integer_hex(void*, imagectx, imagectx)
|
||||
ctf_string(name, name)
|
||||
ctf_string(id, id)
|
||||
)
|
||||
@ -162,3 +174,309 @@ TRACEPOINT_EVENT(librbd, remove_exit,
|
||||
ctf_integer(int, retval, retval)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, aio_write_enter,
|
||||
TP_ARGS(
|
||||
void*, imagectx,
|
||||
const char*, name,
|
||||
const char*, id,
|
||||
uint64_t, off,
|
||||
size_t, len,
|
||||
const char*, buf,
|
||||
const void*, completion),
|
||||
TP_FIELDS(
|
||||
ctf_integer_hex(void*, imagectx, imagectx)
|
||||
ctf_string(name, name)
|
||||
ctf_string(id, id)
|
||||
ctf_integer(uint64_t, off, off)
|
||||
ctf_integer(size_t, len, len)
|
||||
ceph_ctf_sequence(unsigned char, buf, buf, size_t, len)
|
||||
ctf_integer_hex(const void*, completion, completion)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, aio_write_exit,
|
||||
TP_ARGS(
|
||||
int, retval),
|
||||
TP_FIELDS(
|
||||
ctf_integer(int, retval, retval)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, aio_read_enter,
|
||||
TP_ARGS(
|
||||
void*, imagectx,
|
||||
const char*, name,
|
||||
const char*, id,
|
||||
const char*, buf,
|
||||
const void*, completion),
|
||||
TP_FIELDS(
|
||||
ctf_integer_hex(void*, imagectx, imagectx)
|
||||
ctf_string(name, name)
|
||||
ctf_string(id, id)
|
||||
ctf_integer_hex(const void*, completion, completion)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, aio_read_extent,
|
||||
TP_ARGS(
|
||||
uint64_t, offset,
|
||||
uint64_t, length),
|
||||
TP_FIELDS(
|
||||
ctf_integer(uint64_t, offset, offset)
|
||||
ctf_integer(uint64_t, length, length)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, aio_read_exit,
|
||||
TP_ARGS(
|
||||
int, retval),
|
||||
TP_FIELDS(
|
||||
ctf_integer(int, retval, retval)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, aio_discard_enter,
|
||||
TP_ARGS(
|
||||
void*, imagectx,
|
||||
const char*, name,
|
||||
const char*, id,
|
||||
uint64_t, off,
|
||||
uint64_t, len,
|
||||
void*, completion),
|
||||
TP_FIELDS(
|
||||
ctf_integer_hex(void*, imagectx, imagectx)
|
||||
ctf_string(name, name)
|
||||
ctf_string(id, id)
|
||||
ctf_integer(uint64_t, off, off)
|
||||
ctf_integer(uint64_t, len, len)
|
||||
ctf_integer_hex(void*, completion, completion)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, aio_discard_exit,
|
||||
TP_ARGS(
|
||||
int, retval),
|
||||
TP_FIELDS(
|
||||
ctf_integer(int, retval, retval)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, invalidate_cache_enter,
|
||||
TP_ARGS(
|
||||
void*, imagectx,
|
||||
const char*, name,
|
||||
const char*, id),
|
||||
TP_FIELDS(
|
||||
ctf_integer_hex(void*, imagectx, imagectx)
|
||||
ctf_string(name, name)
|
||||
ctf_string(id, id)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, invalidate_cache_exit,
|
||||
TP_ARGS(
|
||||
int, retval),
|
||||
TP_FIELDS(
|
||||
ctf_integer(int, retval, retval)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, flush_enter,
|
||||
TP_ARGS(
|
||||
void*, imagectx,
|
||||
const char*, name,
|
||||
const char*, id),
|
||||
TP_FIELDS(
|
||||
ctf_integer_hex(void*, imagectx, imagectx)
|
||||
ctf_string(name, name)
|
||||
ctf_string(id, id)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, flush_exit,
|
||||
TP_ARGS(
|
||||
int, retval),
|
||||
TP_FIELDS(
|
||||
ctf_integer(int, retval, retval)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, aio_flush_enter,
|
||||
TP_ARGS(
|
||||
void*, imagectx,
|
||||
const char*, name,
|
||||
const char*, id,
|
||||
const void*, completion),
|
||||
TP_FIELDS(
|
||||
ctf_integer_hex(void*, imagectx, imagectx)
|
||||
ctf_string(name, name)
|
||||
ctf_string(id, id)
|
||||
ctf_integer_hex(const void*, completion, completion)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, aio_flush_exit,
|
||||
TP_ARGS(
|
||||
int, retval),
|
||||
TP_FIELDS(
|
||||
ctf_integer(int, retval, retval)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, copy_enter,
|
||||
TP_ARGS(
|
||||
void*, src_imagectx,
|
||||
const char*, src_name,
|
||||
const char*, src_id,
|
||||
void*, dst_imagectx,
|
||||
const char*, dst_name,
|
||||
const char*, dst_id),
|
||||
TP_FIELDS(
|
||||
ctf_integer_hex(void*, src_imagectx, src_imagectx)
|
||||
ctf_string(src_name, src_name)
|
||||
ctf_string(src_id, src_id)
|
||||
ctf_integer_hex(void*, dst_imagectx, dst_imagectx)
|
||||
ctf_string(dst_name, dst_name)
|
||||
ctf_string(dst_id, dst_id)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, copy_exit,
|
||||
TP_ARGS(
|
||||
int, retval),
|
||||
TP_FIELDS(
|
||||
ctf_integer(int, retval, retval)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, resize_enter,
|
||||
TP_ARGS(
|
||||
void*, imagectx,
|
||||
const char*, name,
|
||||
const char*, id,
|
||||
uint64_t, size),
|
||||
TP_FIELDS(
|
||||
ctf_integer_hex(void*, imagectx, imagectx)
|
||||
ctf_string(name, name)
|
||||
ctf_string(id, id)
|
||||
ctf_integer(uint64_t, size, size)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, resize_exit,
|
||||
TP_ARGS(
|
||||
int, retval),
|
||||
TP_FIELDS(
|
||||
ctf_integer(int, retval, retval)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, rename_enter,
|
||||
TP_ARGS(
|
||||
const char*, pool_name,
|
||||
uint64_t, id,
|
||||
const char*, srcname,
|
||||
const char*, dstname),
|
||||
TP_FIELDS(
|
||||
ctf_string(pool_name, pool_name)
|
||||
ctf_integer(uint64_t, id, id)
|
||||
ctf_string(srcname, srcname)
|
||||
ctf_string(dstname, dstname)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, rename_exit,
|
||||
TP_ARGS(
|
||||
int, retval),
|
||||
TP_FIELDS(
|
||||
ctf_integer(int, retval, retval)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, discard_enter,
|
||||
TP_ARGS(
|
||||
void*, imagectx,
|
||||
const char*, name,
|
||||
const char*, id,
|
||||
uint64_t, off,
|
||||
uint64_t, len),
|
||||
TP_FIELDS(
|
||||
ctf_integer_hex(void*, imagectx, imagectx)
|
||||
ctf_string(name, name)
|
||||
ctf_string(id, id)
|
||||
ctf_integer(uint64_t, off, off)
|
||||
ctf_integer(uint64_t, len, len)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, discard_exit,
|
||||
TP_ARGS(
|
||||
int, retval),
|
||||
TP_FIELDS(
|
||||
ctf_integer(int, retval, retval)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, aio_is_complete_enter,
|
||||
TP_ARGS(
|
||||
rbd_completion_t, completion),
|
||||
TP_FIELDS(
|
||||
ctf_integer_hex(rbd_completion_t, completion, completion)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, aio_is_complete_exit,
|
||||
TP_ARGS(
|
||||
int, retval),
|
||||
TP_FIELDS(
|
||||
ctf_integer(int, retval, retval)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, aio_get_return_value_enter,
|
||||
TP_ARGS(
|
||||
rbd_completion_t, completion),
|
||||
TP_FIELDS(
|
||||
ctf_integer_hex(rbd_completion_t, completion, completion)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, aio_get_return_value_exit,
|
||||
TP_ARGS(
|
||||
ssize_t, retval),
|
||||
TP_FIELDS(
|
||||
ctf_integer(ssize_t, retval, retval)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, aio_wait_for_complete_enter,
|
||||
TP_ARGS(
|
||||
rbd_completion_t, completion),
|
||||
TP_FIELDS(
|
||||
ctf_integer_hex(rbd_completion_t, completion, completion)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, aio_wait_for_complete_exit,
|
||||
TP_ARGS(
|
||||
int, retval),
|
||||
TP_FIELDS(
|
||||
ctf_integer(int, retval, retval)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, aio_complete_enter,
|
||||
TP_ARGS(
|
||||
rbd_completion_t, completion,
|
||||
ssize_t, rval),
|
||||
TP_FIELDS(
|
||||
ctf_integer_hex(rbd_completion_t, completion, completion)
|
||||
ctf_integer(ssize_t, rval, rval)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, aio_complete_exit,
|
||||
TP_ARGS(),
|
||||
TP_FIELDS()
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user