mirror of
https://github.com/ceph/ceph
synced 2025-02-23 02:57:21 +00:00
rbd-replay: Move tracepoints from internal.cc to librbd.cc
Signed-off-by: Adam Crume <adamcrume@gmail.com>
This commit is contained in:
parent
0cd2651cad
commit
e555867eef
@ -24,10 +24,6 @@
|
||||
|
||||
#include "librados/snap_set_diff.h"
|
||||
|
||||
#ifdef WITH_LTTNG
|
||||
#include "tracing/librbd.h"
|
||||
#endif
|
||||
|
||||
#define dout_subsys ceph_subsys_rbd
|
||||
#undef dout_prefix
|
||||
#define dout_prefix *_dout << "librbd: "
|
||||
@ -713,14 +709,12 @@ reprotect_and_return_err:
|
||||
int create_v1(IoCtx& io_ctx, const char *imgname, uint64_t bid,
|
||||
uint64_t size, int order)
|
||||
{
|
||||
tracepoint(librbd, create_v1_enter, io_ctx.get_pool_name().c_str(), io_ctx.get_id(), imgname, bid, size, order);
|
||||
CephContext *cct = (CephContext *)io_ctx.cct();
|
||||
ldout(cct, 2) << "adding rbd image to directory..." << dendl;
|
||||
int r = tmap_set(io_ctx, imgname);
|
||||
if (r < 0) {
|
||||
lderr(cct) << "error adding image to directory: " << cpp_strerror(r)
|
||||
<< dendl;
|
||||
tracepoint(librbd, create_v1_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -742,12 +736,10 @@ reprotect_and_return_err:
|
||||
<< "header creation failed: "
|
||||
<< cpp_strerror(r) << dendl;
|
||||
}
|
||||
tracepoint(librbd, create_v1_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
ldout(cct, 2) << "done." << dendl;
|
||||
tracepoint(librbd, create_v1_exit, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -755,7 +747,6 @@ reprotect_and_return_err:
|
||||
int order, uint64_t features, uint64_t stripe_unit,
|
||||
uint64_t stripe_count)
|
||||
{
|
||||
tracepoint(librbd, create_v2_enter, io_ctx.get_pool_name().c_str(), io_ctx.get_id(), imgname, bid, size, order, features, stripe_unit, stripe_count);
|
||||
ostringstream bid_ss;
|
||||
uint32_t extra;
|
||||
string id, id_obj, header_oid;
|
||||
@ -769,7 +760,6 @@ reprotect_and_return_err:
|
||||
if (r < 0) {
|
||||
lderr(cct) << "error creating rbd id object: " << cpp_strerror(r)
|
||||
<< dendl;
|
||||
tracepoint(librbd, create_v2_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -811,7 +801,6 @@ reprotect_and_return_err:
|
||||
}
|
||||
|
||||
ldout(cct, 2) << "done." << dendl;
|
||||
tracepoint(librbd, create_v2_exit, 0);
|
||||
return 0;
|
||||
|
||||
err_remove_header:
|
||||
@ -835,7 +824,6 @@ reprotect_and_return_err:
|
||||
<< cpp_strerror(remove_r) << dendl;
|
||||
}
|
||||
|
||||
tracepoint(librbd, create_v2_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -1078,7 +1066,6 @@ 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;
|
||||
@ -1101,7 +1088,6 @@ 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;
|
||||
}
|
||||
}
|
||||
@ -1112,7 +1098,6 @@ 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;
|
||||
}
|
||||
|
||||
@ -1124,7 +1109,6 @@ 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());
|
||||
@ -1136,12 +1120,10 @@ 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;
|
||||
}
|
||||
|
||||
@ -1154,7 +1136,6 @@ 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;
|
||||
}
|
||||
|
||||
@ -1164,7 +1145,6 @@ 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);
|
||||
@ -1177,7 +1157,6 @@ 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;
|
||||
}
|
||||
}
|
||||
@ -1192,7 +1171,6 @@ reprotect_and_return_err:
|
||||
notify_change(io_ctx, old_header_name(srcname), NULL, NULL);
|
||||
}
|
||||
|
||||
tracepoint(librbd, rename_exit, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1385,7 +1363,6 @@ reprotect_and_return_err:
|
||||
|
||||
int remove(IoCtx& io_ctx, const char *imgname, ProgressContext& prog_ctx)
|
||||
{
|
||||
tracepoint(librbd, remove_enter, io_ctx.get_pool_name().c_str(), io_ctx.get_id(), imgname);
|
||||
CephContext *cct((CephContext *)io_ctx.cct());
|
||||
ldout(cct, 20) << "remove " << &io_ctx << " " << imgname << dendl;
|
||||
|
||||
@ -1405,7 +1382,6 @@ reprotect_and_return_err:
|
||||
if (ictx->snaps.size()) {
|
||||
lderr(cct) << "image has snapshots - not removing" << dendl;
|
||||
close_image(ictx);
|
||||
tracepoint(librbd, remove_exit, -ENOTEMPTY);
|
||||
return -ENOTEMPTY;
|
||||
}
|
||||
|
||||
@ -1414,13 +1390,11 @@ reprotect_and_return_err:
|
||||
if (r < 0) {
|
||||
lderr(cct) << "error listing watchers" << dendl;
|
||||
close_image(ictx);
|
||||
tracepoint(librbd, remove_exit, r);
|
||||
return r;
|
||||
}
|
||||
if (watchers.size() > 1) {
|
||||
lderr(cct) << "image has watchers - not removing" << dendl;
|
||||
close_image(ictx);
|
||||
tracepoint(librbd, remove_exit, -EBUSY);
|
||||
return -EBUSY;
|
||||
}
|
||||
assert(watchers.size() == 1);
|
||||
@ -1439,7 +1413,6 @@ reprotect_and_return_err:
|
||||
if (r < 0 && r != -ENOENT) {
|
||||
lderr(cct) << "error removing child from children list" << dendl;
|
||||
close_image(ictx);
|
||||
tracepoint(librbd, remove_exit, r);
|
||||
return r;
|
||||
}
|
||||
close_image(ictx);
|
||||
@ -1448,7 +1421,6 @@ reprotect_and_return_err:
|
||||
r = io_ctx.remove(header_oid);
|
||||
if (r < 0 && r != -ENOENT) {
|
||||
lderr(cct) << "error removing header: " << cpp_strerror(-r) << dendl;
|
||||
tracepoint(librbd, remove_exit, r);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
@ -1460,7 +1432,6 @@ reprotect_and_return_err:
|
||||
if (r < 0 && !unknown_format) {
|
||||
lderr(cct) << "error removing img from old-style directory: "
|
||||
<< cpp_strerror(-r) << dendl;
|
||||
tracepoint(librbd, remove_exit, r);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
@ -1469,14 +1440,12 @@ reprotect_and_return_err:
|
||||
r = io_ctx.remove(id_obj_name(imgname));
|
||||
if (r < 0 && r != -ENOENT) {
|
||||
lderr(cct) << "error removing id object: " << cpp_strerror(r) << dendl;
|
||||
tracepoint(librbd, remove_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
r = cls_client::dir_get_id(&io_ctx, RBD_DIRECTORY, imgname, &id);
|
||||
if (r < 0 && r != -ENOENT) {
|
||||
lderr(cct) << "error getting id of image" << dendl;
|
||||
tracepoint(librbd, remove_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -1485,13 +1454,11 @@ reprotect_and_return_err:
|
||||
if (r < 0) {
|
||||
lderr(cct) << "error removing img from new-style directory: "
|
||||
<< cpp_strerror(-r) << dendl;
|
||||
tracepoint(librbd, remove_exit, r);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
ldout(cct, 2) << "done." << dendl;
|
||||
tracepoint(librbd, remove_exit, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1543,19 +1510,16 @@ reprotect_and_return_err:
|
||||
|
||||
int resize(ImageCtx *ictx, uint64_t size, ProgressContext& prog_ctx)
|
||||
{
|
||||
tracepoint(librbd, resize_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only, size);
|
||||
CephContext *cct = ictx->cct;
|
||||
ldout(cct, 20) << "resize " << ictx << " " << ictx->size << " -> "
|
||||
<< size << dendl;
|
||||
|
||||
if (ictx->read_only) {
|
||||
tracepoint(librbd, resize_exit, -EROFS);
|
||||
return -EROFS;
|
||||
}
|
||||
|
||||
int r = ictx_check(ictx);
|
||||
if (r < 0) {
|
||||
tracepoint(librbd, resize_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -1565,7 +1529,6 @@ reprotect_and_return_err:
|
||||
// ObjectCacher doesn't track non-existent objects
|
||||
r = ictx->invalidate_cache();
|
||||
if (r < 0) {
|
||||
tracepoint(librbd, resize_exit, r);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
@ -1574,7 +1537,6 @@ reprotect_and_return_err:
|
||||
ldout(cct, 2) << "done." << dendl;
|
||||
|
||||
ictx->perfcounter->inc(l_librbd_resize);
|
||||
tracepoint(librbd, resize_exit, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2048,7 +2010,6 @@ reprotect_and_return_err:
|
||||
|
||||
int copy(ImageCtx *src, ImageCtx *dest, ProgressContext &prog_ctx)
|
||||
{
|
||||
tracepoint(librbd, copy_enter, src, src->name.c_str(), src->snap_name.c_str(), src->read_only, dest, dest->name.c_str(), dest->snap_name.c_str(), dest->read_only);
|
||||
src->md_lock.get_read();
|
||||
src->snap_lock.get_read();
|
||||
uint64_t src_size = src->get_image_size(src->snap_id);
|
||||
@ -2065,7 +2026,6 @@ 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;
|
||||
@ -2084,7 +2044,6 @@ 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);
|
||||
@ -2093,7 +2052,6 @@ 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;
|
||||
}
|
||||
|
||||
@ -2135,7 +2093,6 @@ reprotect_and_return_err:
|
||||
|
||||
int open_image(ImageCtx *ictx)
|
||||
{
|
||||
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
|
||||
@ -2163,18 +2120,15 @@ reprotect_and_return_err:
|
||||
if ((r = _snap_set(ictx, ictx->snap_name.c_str())) < 0)
|
||||
goto err_close;
|
||||
|
||||
tracepoint(librbd, open_image_exit, 0);
|
||||
return 0;
|
||||
|
||||
err_close:
|
||||
close_image(ictx);
|
||||
tracepoint(librbd, open_image_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
void close_image(ImageCtx *ictx)
|
||||
{
|
||||
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
|
||||
@ -2190,7 +2144,6 @@ reprotect_and_return_err:
|
||||
ictx->unregister_watch();
|
||||
|
||||
delete ictx;
|
||||
tracepoint(librbd, close_image_exit);
|
||||
}
|
||||
|
||||
// 'flatten' child image by copying all parent's blocks
|
||||
@ -2691,12 +2644,6 @@ 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, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only);
|
||||
for (vector<pair<uint64_t,uint64_t> >::const_iterator r = image_extents.begin();
|
||||
r != image_extents.end();
|
||||
++r) {
|
||||
tracepoint(librbd, read_extent, r->first, r->second);
|
||||
}
|
||||
Mutex mylock("IoCtxImpl::write::mylock");
|
||||
Cond cond;
|
||||
bool done;
|
||||
@ -2708,7 +2655,6 @@ reprotect_and_return_err:
|
||||
if (r < 0) {
|
||||
c->release();
|
||||
delete ctx;
|
||||
tracepoint(librbd, read_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -2717,13 +2663,11 @@ reprotect_and_return_err:
|
||||
cond.Wait(mylock);
|
||||
mylock.Unlock();
|
||||
|
||||
tracepoint(librbd, read_exit, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ssize_t write(ImageCtx *ictx, uint64_t off, size_t len, const char *buf)
|
||||
{
|
||||
tracepoint(librbd, write_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only, off, len, buf);
|
||||
utime_t start_time, elapsed;
|
||||
ldout(ictx->cct, 20) << "write " << ictx << " off = " << off << " len = "
|
||||
<< len << dendl;
|
||||
@ -2737,7 +2681,6 @@ reprotect_and_return_err:
|
||||
uint64_t mylen = len;
|
||||
int r = clip_io(ictx, off, &mylen);
|
||||
if (r < 0) {
|
||||
tracepoint(librbd, write_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -2747,7 +2690,6 @@ reprotect_and_return_err:
|
||||
if (r < 0) {
|
||||
c->release();
|
||||
delete ctx;
|
||||
tracepoint(librbd, write_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -2757,7 +2699,6 @@ reprotect_and_return_err:
|
||||
mylock.Unlock();
|
||||
|
||||
if (ret < 0) {
|
||||
tracepoint(librbd, write_exit, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -2765,13 +2706,11 @@ reprotect_and_return_err:
|
||||
ictx->perfcounter->tinc(l_librbd_wr_latency, elapsed);
|
||||
ictx->perfcounter->inc(l_librbd_wr);
|
||||
ictx->perfcounter->inc(l_librbd_wr_bytes, mylen);
|
||||
tracepoint(librbd, write_exit, mylen);
|
||||
return mylen;
|
||||
}
|
||||
|
||||
int discard(ImageCtx *ictx, uint64_t off, uint64_t len)
|
||||
{
|
||||
tracepoint(librbd, discard_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only, off, len);
|
||||
utime_t start_time, elapsed;
|
||||
ldout(ictx->cct, 20) << "discard " << ictx << " off = " << off << " len = "
|
||||
<< len << dendl;
|
||||
@ -2788,7 +2727,6 @@ reprotect_and_return_err:
|
||||
if (r < 0) {
|
||||
c->release();
|
||||
delete ctx;
|
||||
tracepoint(librbd, discard_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -2798,7 +2736,6 @@ reprotect_and_return_err:
|
||||
mylock.Unlock();
|
||||
|
||||
if (ret < 0) {
|
||||
tracepoint(librbd, discard_exit, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -2806,7 +2743,6 @@ reprotect_and_return_err:
|
||||
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;
|
||||
}
|
||||
|
||||
@ -2913,13 +2849,11 @@ reprotect_and_return_err:
|
||||
|
||||
int aio_flush(ImageCtx *ictx, AioCompletion *c)
|
||||
{
|
||||
tracepoint(librbd, aio_flush_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only, c);
|
||||
CephContext *cct = ictx->cct;
|
||||
ldout(cct, 20) << "aio_flush " << ictx << " completion " << c << dendl;
|
||||
|
||||
int r = ictx_check(ictx);
|
||||
if (r < 0) {
|
||||
tracepoint(librbd, aio_flush_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -2941,26 +2875,22 @@ 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->snap_name.c_str(), ictx->read_only);
|
||||
CephContext *cct = ictx->cct;
|
||||
ldout(cct, 20) << "flush " << ictx << dendl;
|
||||
|
||||
int r = ictx_check(ictx);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -2983,40 +2913,34 @@ reprotect_and_return_err:
|
||||
|
||||
int invalidate_cache(ImageCtx *ictx)
|
||||
{
|
||||
tracepoint(librbd, invalidate_cache_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only);
|
||||
CephContext *cct = ictx->cct;
|
||||
ldout(cct, 20) << "invalidate_cache " << ictx << dendl;
|
||||
|
||||
int r = ictx_check(ictx);
|
||||
if (r < 0) {
|
||||
tracepoint(librbd, invalidate_cache_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
RWLock::WLocker l(ictx->md_lock);
|
||||
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->snap_name.c_str(), ictx->read_only, 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) {
|
||||
tracepoint(librbd, aio_write_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
uint64_t mylen = len;
|
||||
r = clip_io(ictx, off, &mylen);
|
||||
if (r < 0) {
|
||||
tracepoint(librbd, aio_write_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -3030,7 +2954,6 @@ reprotect_and_return_err:
|
||||
ictx->snap_lock.put_read();
|
||||
|
||||
if (snap_id != CEPH_NOSNAP || ictx->read_only) {
|
||||
tracepoint(librbd, aio_write_exit, -EROFS);
|
||||
return -EROFS;
|
||||
}
|
||||
|
||||
@ -3085,26 +3008,22 @@ 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->snap_name.c_str(), ictx->read_only, 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) {
|
||||
tracepoint(librbd, aio_discard_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
r = clip_io(ictx, off, &len);
|
||||
if (r < 0) {
|
||||
tracepoint(librbd, aio_discard_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -3119,7 +3038,6 @@ reprotect_and_return_err:
|
||||
ictx->snap_lock.put_read();
|
||||
|
||||
if (snap_id != CEPH_NOSNAP || ictx->read_only) {
|
||||
tracepoint(librbd, aio_discard_exit, -EROFS);
|
||||
return -EROFS;
|
||||
}
|
||||
|
||||
@ -3179,7 +3097,6 @@ 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;
|
||||
}
|
||||
|
||||
@ -3202,17 +3119,10 @@ 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->snap_name.c_str(), ictx->read_only, 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) {
|
||||
tracepoint(librbd, aio_read_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -3230,7 +3140,6 @@ reprotect_and_return_err:
|
||||
uint64_t len = p->second;
|
||||
r = clip_io(ictx, p->first, &len);
|
||||
if (r < 0) {
|
||||
tracepoint(librbd, aio_read_exit, r);
|
||||
return r;
|
||||
}
|
||||
if (len == 0)
|
||||
@ -3286,7 +3195,6 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,10 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#ifdef WITH_LTTNG
|
||||
#include "tracing/librbd.h"
|
||||
#endif
|
||||
|
||||
#define dout_subsys ceph_subsys_rbd
|
||||
#undef dout_prefix
|
||||
#define dout_prefix *_dout << "librbd: "
|
||||
@ -91,12 +95,16 @@ namespace librbd {
|
||||
const char *snap_name)
|
||||
{
|
||||
ImageCtx *ictx = new ImageCtx(name, "", snap_name, io_ctx, false);
|
||||
tracepoint(librbd, open_image_enter, ictx, ictx->name.c_str(), ictx->id.c_str(), ictx->snap_name.c_str(), ictx->read_only);
|
||||
|
||||
int r = librbd::open_image(ictx);
|
||||
if (r < 0)
|
||||
if (r < 0) {
|
||||
tracepoint(librbd, open_image_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
image.ctx = (image_ctx_t) ictx;
|
||||
tracepoint(librbd, open_image_exit, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -104,32 +112,45 @@ namespace librbd {
|
||||
const char *snap_name)
|
||||
{
|
||||
ImageCtx *ictx = new ImageCtx(name, "", snap_name, io_ctx, true);
|
||||
tracepoint(librbd, open_image_enter, ictx, ictx->name.c_str(), ictx->id.c_str(), ictx->snap_name.c_str(), ictx->read_only);
|
||||
|
||||
int r = librbd::open_image(ictx);
|
||||
if (r < 0)
|
||||
if (r < 0) {
|
||||
tracepoint(librbd, open_image_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
image.ctx = (image_ctx_t) ictx;
|
||||
tracepoint(librbd, open_image_exit, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int RBD::create(IoCtx& io_ctx, const char *name, uint64_t size, int *order)
|
||||
{
|
||||
return librbd::create(io_ctx, name, size, order);
|
||||
tracepoint(librbd, create_enter, io_ctx.get_pool_name().c_str(), io_ctx.get_id(), name, size, *order);
|
||||
int r = librbd::create(io_ctx, name, size, order);
|
||||
tracepoint(librbd, create_exit, r, *order);
|
||||
return r;
|
||||
}
|
||||
|
||||
int RBD::create2(IoCtx& io_ctx, const char *name, uint64_t size,
|
||||
uint64_t features, int *order)
|
||||
{
|
||||
return librbd::create(io_ctx, name, size, false, features, order, 0, 0);
|
||||
tracepoint(librbd, create2_enter, io_ctx.get_pool_name().c_str(), io_ctx.get_id(), name, size, features, *order);
|
||||
int r = librbd::create(io_ctx, name, size, false, features, order, 0, 0);
|
||||
tracepoint(librbd, create2_exit, r, *order);
|
||||
return r;
|
||||
}
|
||||
|
||||
int RBD::create3(IoCtx& io_ctx, const char *name, uint64_t size,
|
||||
uint64_t features, int *order, uint64_t stripe_unit,
|
||||
uint64_t stripe_count)
|
||||
{
|
||||
return librbd::create(io_ctx, name, size, false, features, order,
|
||||
tracepoint(librbd, create3_enter, io_ctx.get_pool_name().c_str(), io_ctx.get_id(), name, size, features, *order, stripe_unit, stripe_count);
|
||||
int r = librbd::create(io_ctx, name, size, false, features, order,
|
||||
stripe_unit, stripe_count);
|
||||
tracepoint(librbd, create3_exit, r, *order);
|
||||
return r;
|
||||
}
|
||||
|
||||
int RBD::clone(IoCtx& p_ioctx, const char *p_name, const char *p_snap_name,
|
||||
@ -150,15 +171,19 @@ namespace librbd {
|
||||
|
||||
int RBD::remove(IoCtx& io_ctx, const char *name)
|
||||
{
|
||||
tracepoint(librbd, remove_enter, io_ctx.get_pool_name().c_str(), io_ctx.get_id(), name);
|
||||
librbd::NoOpProgressContext prog_ctx;
|
||||
int r = librbd::remove(io_ctx, name, prog_ctx);
|
||||
tracepoint(librbd, remove_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
int RBD::remove_with_progress(IoCtx& io_ctx, const char *name,
|
||||
ProgressContext& pctx)
|
||||
{
|
||||
tracepoint(librbd, remove_enter, io_ctx.get_pool_name().c_str(), io_ctx.get_id(), name);
|
||||
int r = librbd::remove(io_ctx, name, pctx);
|
||||
tracepoint(librbd, remove_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -170,7 +195,9 @@ namespace librbd {
|
||||
|
||||
int RBD::rename(IoCtx& src_io_ctx, const char *srcname, const char *destname)
|
||||
{
|
||||
tracepoint(librbd, rename_enter, src_io_ctx.get_pool_name().c_str(), src_io_ctx.get_id(), srcname, destname);
|
||||
int r = librbd::rename(src_io_ctx, srcname, destname);
|
||||
tracepoint(librbd, rename_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -219,21 +246,29 @@ namespace librbd {
|
||||
{
|
||||
if (ctx) {
|
||||
ImageCtx *ictx = (ImageCtx *)ctx;
|
||||
tracepoint(librbd, close_image_enter, ictx, ictx->name.c_str(), ictx->id.c_str());
|
||||
close_image(ictx);
|
||||
tracepoint(librbd, close_image_exit);
|
||||
}
|
||||
}
|
||||
|
||||
int Image::resize(uint64_t size)
|
||||
{
|
||||
ImageCtx *ictx = (ImageCtx *)ctx;
|
||||
tracepoint(librbd, resize_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only, size);
|
||||
librbd::NoOpProgressContext prog_ctx;
|
||||
return librbd::resize(ictx, size, prog_ctx);
|
||||
int r = librbd::resize(ictx, size, prog_ctx);
|
||||
tracepoint(librbd, resize_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
int Image::resize_with_progress(uint64_t size, librbd::ProgressContext& pctx)
|
||||
{
|
||||
ImageCtx *ictx = (ImageCtx *)ctx;
|
||||
return librbd::resize(ictx, size, pctx);
|
||||
tracepoint(librbd, resize_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only, size);
|
||||
int r = librbd::resize(ictx, size, pctx);
|
||||
tracepoint(librbd, resize_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
int Image::stat(image_info_t& info, size_t infosize)
|
||||
@ -289,30 +324,42 @@ namespace librbd {
|
||||
int Image::copy(IoCtx& dest_io_ctx, const char *destname)
|
||||
{
|
||||
ImageCtx *ictx = (ImageCtx *)ctx;
|
||||
tracepoint(librbd, copy_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only, destname);
|
||||
librbd::NoOpProgressContext prog_ctx;
|
||||
return librbd::copy(ictx, dest_io_ctx, destname, prog_ctx);
|
||||
int r = librbd::copy(ictx, dest_io_ctx, destname, prog_ctx);
|
||||
tracepoint(librbd, copy_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
int Image::copy2(Image& dest)
|
||||
{
|
||||
ImageCtx *srcctx = (ImageCtx *)ctx;
|
||||
ImageCtx *destctx = (ImageCtx *)dest.ctx;
|
||||
tracepoint(librbd, copy2_enter, srcctx, srcctx->name.c_str(), srcctx->snap_name.c_str(), srcctx->read_only, destctx, destctx->name.c_str(), destctx->snap_name.c_str(), destctx->read_only);
|
||||
librbd::NoOpProgressContext prog_ctx;
|
||||
return librbd::copy(srcctx, destctx, prog_ctx);
|
||||
int r = librbd::copy(srcctx, destctx, prog_ctx);
|
||||
tracepoint(librbd, copy2_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
int Image::copy_with_progress(IoCtx& dest_io_ctx, const char *destname,
|
||||
librbd::ProgressContext &pctx)
|
||||
{
|
||||
ImageCtx *ictx = (ImageCtx *)ctx;
|
||||
return librbd::copy(ictx, dest_io_ctx, destname, pctx);
|
||||
tracepoint(librbd, copy_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only, destname);
|
||||
int r = librbd::copy(ictx, dest_io_ctx, destname, pctx);
|
||||
tracepoint(librbd, copy_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
int Image::copy_with_progress2(Image& dest, librbd::ProgressContext &pctx)
|
||||
{
|
||||
ImageCtx *srcctx = (ImageCtx *)ctx;
|
||||
ImageCtx *destctx = (ImageCtx *)dest.ctx;
|
||||
return librbd::copy(srcctx, destctx, pctx);
|
||||
tracepoint(librbd, copy2_enter, srcctx, srcctx->name.c_str(), srcctx->snap_name.c_str(), srcctx->read_only, destctx, destctx->name.c_str(), destctx->snap_name.c_str(), destctx->read_only);
|
||||
int r = librbd::copy(srcctx, destctx, pctx);
|
||||
tracepoint(librbd, copy2_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
int Image::flatten()
|
||||
@ -430,9 +477,14 @@ namespace librbd {
|
||||
ssize_t Image::read(uint64_t ofs, size_t len, bufferlist& bl)
|
||||
{
|
||||
ImageCtx *ictx = (ImageCtx *)ctx;
|
||||
// TODO: Should these be merged?
|
||||
tracepoint(librbd, read_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only);
|
||||
tracepoint(librbd, read_extent, ofs, len);
|
||||
bufferptr ptr(len);
|
||||
bl.push_back(ptr);
|
||||
return librbd::read(ictx, ofs, len, bl.c_str());
|
||||
int r = librbd::read(ictx, ofs, len, bl.c_str());
|
||||
tracepoint(librbd, read_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
int64_t Image::read_iterate(uint64_t ofs, size_t len,
|
||||
@ -466,58 +518,88 @@ namespace librbd {
|
||||
ssize_t Image::write(uint64_t ofs, size_t len, bufferlist& bl)
|
||||
{
|
||||
ImageCtx *ictx = (ImageCtx *)ctx;
|
||||
if (bl.length() < len)
|
||||
tracepoint(librbd, write_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only, ofs, len, bl.length() < len ? NULL : bl.c_str());
|
||||
if (bl.length() < len) {
|
||||
tracepoint(librbd, write_exit, -EINVAL);
|
||||
return -EINVAL;
|
||||
return librbd::write(ictx, ofs, len, bl.c_str());
|
||||
}
|
||||
int r = librbd::write(ictx, ofs, len, bl.c_str());
|
||||
tracepoint(librbd, write_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
int Image::discard(uint64_t ofs, uint64_t len)
|
||||
{
|
||||
ImageCtx *ictx = (ImageCtx *)ctx;
|
||||
return librbd::discard(ictx, ofs, len);
|
||||
tracepoint(librbd, discard_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only, ofs, len);
|
||||
int r = librbd::discard(ictx, ofs, len);
|
||||
tracepoint(librbd, discard_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
int Image::aio_write(uint64_t off, size_t len, bufferlist& bl,
|
||||
RBD::AioCompletion *c)
|
||||
{
|
||||
ImageCtx *ictx = (ImageCtx *)ctx;
|
||||
if (bl.length() < len)
|
||||
tracepoint(librbd, aio_write_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only, off, len, bl.length() < len ? NULL : bl.c_str(), c->pc);
|
||||
if (bl.length() < len) {
|
||||
tracepoint(librbd, aio_write_exit, -EINVAL);
|
||||
return -EINVAL;
|
||||
return librbd::aio_write(ictx, off, len, bl.c_str(),
|
||||
}
|
||||
int r = librbd::aio_write(ictx, off, len, bl.c_str(),
|
||||
(librbd::AioCompletion *)c->pc);
|
||||
tracepoint(librbd, aio_write_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
int Image::aio_discard(uint64_t off, uint64_t len, RBD::AioCompletion *c)
|
||||
{
|
||||
ImageCtx *ictx = (ImageCtx *)ctx;
|
||||
return librbd::aio_discard(ictx, off, len, (librbd::AioCompletion *)c->pc);
|
||||
tracepoint(librbd, aio_discard_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only, off, len, c->pc);
|
||||
int r = librbd::aio_discard(ictx, off, len, (librbd::AioCompletion *)c->pc);
|
||||
tracepoint(librbd, aio_discard_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
int Image::aio_read(uint64_t off, size_t len, bufferlist& bl,
|
||||
RBD::AioCompletion *c)
|
||||
{
|
||||
ImageCtx *ictx = (ImageCtx *)ctx;
|
||||
// TODO: See if these tracepoints should be merged
|
||||
tracepoint(librbd, aio_read_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only, bl.c_str(), c->pc);
|
||||
tracepoint(librbd, aio_read_extent, off, len);
|
||||
ldout(ictx->cct, 10) << "Image::aio_read() buf=" << (void *)bl.c_str() << "~"
|
||||
<< (void *)(bl.c_str() + len - 1) << dendl;
|
||||
return librbd::aio_read(ictx, off, len, NULL, &bl, (librbd::AioCompletion *)c->pc);
|
||||
int r = librbd::aio_read(ictx, off, len, NULL, &bl, (librbd::AioCompletion *)c->pc);
|
||||
tracepoint(librbd, aio_read_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
int Image::flush()
|
||||
{
|
||||
ImageCtx *ictx = (ImageCtx *)ctx;
|
||||
return librbd::flush(ictx);
|
||||
tracepoint(librbd, flush_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only);
|
||||
int r = librbd::flush(ictx);
|
||||
tracepoint(librbd, flush_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
int Image::aio_flush(RBD::AioCompletion *c)
|
||||
{
|
||||
ImageCtx *ictx = (ImageCtx *)ctx;
|
||||
return librbd::aio_flush(ictx, (librbd::AioCompletion *)c->pc);
|
||||
tracepoint(librbd, aio_flush_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only, c->pc);
|
||||
int r = librbd::aio_flush(ictx, (librbd::AioCompletion *)c->pc);
|
||||
tracepoint(librbd, aio_flush_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
int Image::invalidate_cache()
|
||||
{
|
||||
ImageCtx *ictx = (ImageCtx *)ctx;
|
||||
return librbd::invalidate_cache(ictx);
|
||||
tracepoint(librbd, invalidate_cache_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only);
|
||||
int r = librbd::invalidate_cache(ictx);
|
||||
tracepoint(librbd, invalidate_cache_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
} // namespace librbd
|
||||
@ -566,7 +648,10 @@ extern "C" int rbd_create(rados_ioctx_t p, const char *name, uint64_t size, int
|
||||
{
|
||||
librados::IoCtx io_ctx;
|
||||
librados::IoCtx::from_rados_ioctx_t(p, io_ctx);
|
||||
return librbd::create(io_ctx, name, size, order);
|
||||
tracepoint(librbd, create_enter, io_ctx.get_pool_name().c_str(), io_ctx.get_id(), name, size, *order);
|
||||
int r = librbd::create(io_ctx, name, size, order);
|
||||
tracepoint(librbd, create_exit, r, *order);
|
||||
return r;
|
||||
}
|
||||
|
||||
extern "C" int rbd_create2(rados_ioctx_t p, const char *name,
|
||||
@ -575,7 +660,10 @@ extern "C" int rbd_create2(rados_ioctx_t p, const char *name,
|
||||
{
|
||||
librados::IoCtx io_ctx;
|
||||
librados::IoCtx::from_rados_ioctx_t(p, io_ctx);
|
||||
return librbd::create(io_ctx, name, size, false, features, order, 0, 0);
|
||||
tracepoint(librbd, create2_enter, io_ctx.get_pool_name().c_str(), io_ctx.get_id(), name, size, features, *order);
|
||||
int r = librbd::create(io_ctx, name, size, false, features, order, 0, 0);
|
||||
tracepoint(librbd, create2_exit, r, *order);
|
||||
return r;
|
||||
}
|
||||
|
||||
extern "C" int rbd_create3(rados_ioctx_t p, const char *name,
|
||||
@ -585,8 +673,11 @@ extern "C" int rbd_create3(rados_ioctx_t p, const char *name,
|
||||
{
|
||||
librados::IoCtx io_ctx;
|
||||
librados::IoCtx::from_rados_ioctx_t(p, io_ctx);
|
||||
return librbd::create(io_ctx, name, size, false, features, order,
|
||||
tracepoint(librbd, create3_enter, io_ctx.get_pool_name().c_str(), io_ctx.get_id(), name, size, features, *order, stripe_unit, stripe_count);
|
||||
int r = librbd::create(io_ctx, name, size, false, features, order,
|
||||
stripe_unit, stripe_count);
|
||||
tracepoint(librbd, create3_exit, r, *order);
|
||||
return r;
|
||||
}
|
||||
|
||||
extern "C" int rbd_clone(rados_ioctx_t p_ioctx, const char *p_name,
|
||||
@ -616,8 +707,11 @@ extern "C" int rbd_remove(rados_ioctx_t p, const char *name)
|
||||
{
|
||||
librados::IoCtx io_ctx;
|
||||
librados::IoCtx::from_rados_ioctx_t(p, io_ctx);
|
||||
tracepoint(librbd, remove_enter, io_ctx.get_pool_name().c_str(), io_ctx.get_id(), name);
|
||||
librbd::NoOpProgressContext prog_ctx;
|
||||
return librbd::remove(io_ctx, name, prog_ctx);
|
||||
int r = librbd::remove(io_ctx, name, prog_ctx);
|
||||
tracepoint(librbd, remove_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
extern "C" int rbd_remove_with_progress(rados_ioctx_t p, const char *name,
|
||||
@ -625,8 +719,11 @@ extern "C" int rbd_remove_with_progress(rados_ioctx_t p, const char *name,
|
||||
{
|
||||
librados::IoCtx io_ctx;
|
||||
librados::IoCtx::from_rados_ioctx_t(p, io_ctx);
|
||||
tracepoint(librbd, remove_enter, io_ctx.get_pool_name().c_str(), io_ctx.get_id(), name);
|
||||
librbd::CProgressContext prog_ctx(cb, cbdata);
|
||||
return librbd::remove(io_ctx, name, prog_ctx);
|
||||
int r = librbd::remove(io_ctx, name, prog_ctx);
|
||||
tracepoint(librbd, remove_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
extern "C" int rbd_copy(rbd_image_t image, rados_ioctx_t dest_p,
|
||||
@ -689,7 +786,10 @@ extern "C" int rbd_rename(rados_ioctx_t src_p, const char *srcname,
|
||||
{
|
||||
librados::IoCtx src_io_ctx;
|
||||
librados::IoCtx::from_rados_ioctx_t(src_p, src_io_ctx);
|
||||
return librbd::rename(src_io_ctx, srcname, destname);
|
||||
tracepoint(librbd, rename_enter, src_io_ctx.get_pool_name().c_str(), src_io_ctx.get_id(), srcname, destname);
|
||||
int r = librbd::rename(src_io_ctx, srcname, destname);
|
||||
tracepoint(librbd, rename_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
extern "C" int rbd_open(rados_ioctx_t p, const char *name, rbd_image_t *image,
|
||||
@ -699,9 +799,11 @@ extern "C" int rbd_open(rados_ioctx_t p, const char *name, rbd_image_t *image,
|
||||
librados::IoCtx::from_rados_ioctx_t(p, io_ctx);
|
||||
librbd::ImageCtx *ictx = new librbd::ImageCtx(name, "", snap_name, io_ctx,
|
||||
false);
|
||||
tracepoint(librbd, open_image_enter, ictx, ictx->name.c_str(), ictx->id.c_str(), ictx->snap_name.c_str(), ictx->read_only);
|
||||
int r = librbd::open_image(ictx);
|
||||
if (r >= 0)
|
||||
*image = (rbd_image_t)ictx;
|
||||
tracepoint(librbd, open_image_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -712,32 +814,42 @@ extern "C" int rbd_open_read_only(rados_ioctx_t p, const char *name,
|
||||
librados::IoCtx::from_rados_ioctx_t(p, io_ctx);
|
||||
librbd::ImageCtx *ictx = new librbd::ImageCtx(name, "", snap_name, io_ctx,
|
||||
true);
|
||||
tracepoint(librbd, open_image_enter, ictx, ictx->name.c_str(), ictx->id.c_str(), ictx->snap_name.c_str(), ictx->read_only);
|
||||
int r = librbd::open_image(ictx);
|
||||
if (r >= 0)
|
||||
*image = (rbd_image_t)ictx;
|
||||
tracepoint(librbd, open_image_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
extern "C" int rbd_close(rbd_image_t image)
|
||||
{
|
||||
librbd::ImageCtx *ctx = (librbd::ImageCtx *)image;
|
||||
tracepoint(librbd, close_image_enter, ctx, ctx->name.c_str(), ctx->id.c_str());
|
||||
librbd::close_image(ctx);
|
||||
tracepoint(librbd, close_image_exit);
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" int rbd_resize(rbd_image_t image, uint64_t size)
|
||||
{
|
||||
librbd::ImageCtx *ictx = (librbd::ImageCtx *)image;
|
||||
tracepoint(librbd, resize_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only, size);
|
||||
librbd::NoOpProgressContext prog_ctx;
|
||||
return librbd::resize(ictx, size, prog_ctx);
|
||||
int r = librbd::resize(ictx, size, prog_ctx);
|
||||
tracepoint(librbd, resize_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
extern "C" int rbd_resize_with_progress(rbd_image_t image, uint64_t size,
|
||||
librbd_progress_fn_t cb, void *cbdata)
|
||||
{
|
||||
librbd::ImageCtx *ictx = (librbd::ImageCtx *)image;
|
||||
tracepoint(librbd, resize_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only, size);
|
||||
librbd::CProgressContext prog_ctx(cb, cbdata);
|
||||
return librbd::resize(ictx, size, prog_ctx);
|
||||
int r = librbd::resize(ictx, size, prog_ctx);
|
||||
tracepoint(librbd, resize_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
extern "C" int rbd_stat(rbd_image_t image, rbd_image_info_t *info,
|
||||
@ -1051,7 +1163,12 @@ extern "C" ssize_t rbd_read(rbd_image_t image, uint64_t ofs, size_t len,
|
||||
char *buf)
|
||||
{
|
||||
librbd::ImageCtx *ictx = (librbd::ImageCtx *)image;
|
||||
return librbd::read(ictx, ofs, len, buf);
|
||||
// TODO: Should these tracepoints be combined?
|
||||
tracepoint(librbd, read_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only);
|
||||
tracepoint(librbd, read_extent, ofs, len);
|
||||
int r = librbd::read(ictx, ofs, len, buf);
|
||||
tracepoint(librbd, read_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
extern "C" int64_t rbd_read_iterate(rbd_image_t image, uint64_t ofs, size_t len,
|
||||
@ -1087,13 +1204,19 @@ extern "C" ssize_t rbd_write(rbd_image_t image, uint64_t ofs, size_t len,
|
||||
const char *buf)
|
||||
{
|
||||
librbd::ImageCtx *ictx = (librbd::ImageCtx *)image;
|
||||
return librbd::write(ictx, ofs, len, buf);
|
||||
tracepoint(librbd, write_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only, ofs, len, buf);
|
||||
int r = librbd::write(ictx, ofs, len, buf);
|
||||
tracepoint(librbd, write_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
extern "C" int rbd_discard(rbd_image_t image, uint64_t ofs, uint64_t len)
|
||||
{
|
||||
librbd::ImageCtx *ictx = (librbd::ImageCtx *)image;
|
||||
return librbd::discard(ictx, ofs, len);
|
||||
tracepoint(librbd, discard_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only, ofs, len);
|
||||
int r = librbd::discard(ictx, ofs, len);
|
||||
tracepoint(librbd, discard_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
extern "C" int rbd_aio_create_completion(void *cb_arg,
|
||||
@ -1111,8 +1234,11 @@ extern "C" int rbd_aio_write(rbd_image_t image, uint64_t off, size_t len,
|
||||
{
|
||||
librbd::ImageCtx *ictx = (librbd::ImageCtx *)image;
|
||||
librbd::RBD::AioCompletion *comp = (librbd::RBD::AioCompletion *)c;
|
||||
return librbd::aio_write(ictx, off, len, buf,
|
||||
tracepoint(librbd, aio_write_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only, off, len, buf, comp->pc);
|
||||
int r = librbd::aio_write(ictx, off, len, buf,
|
||||
(librbd::AioCompletion *)comp->pc);
|
||||
tracepoint(librbd, aio_write_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
extern "C" int rbd_aio_discard(rbd_image_t image, uint64_t off, uint64_t len,
|
||||
@ -1120,7 +1246,10 @@ extern "C" int rbd_aio_discard(rbd_image_t image, uint64_t off, uint64_t len,
|
||||
{
|
||||
librbd::ImageCtx *ictx = (librbd::ImageCtx *)image;
|
||||
librbd::RBD::AioCompletion *comp = (librbd::RBD::AioCompletion *)c;
|
||||
return librbd::aio_discard(ictx, off, len, (librbd::AioCompletion *)comp->pc);
|
||||
tracepoint(librbd, aio_discard_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only, off, len, comp->pc);
|
||||
int r = librbd::aio_discard(ictx, off, len, (librbd::AioCompletion *)comp->pc);
|
||||
tracepoint(librbd, aio_discard_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
extern "C" int rbd_aio_read(rbd_image_t image, uint64_t off, size_t len,
|
||||
@ -1128,27 +1257,41 @@ extern "C" int rbd_aio_read(rbd_image_t image, uint64_t off, size_t len,
|
||||
{
|
||||
librbd::ImageCtx *ictx = (librbd::ImageCtx *)image;
|
||||
librbd::RBD::AioCompletion *comp = (librbd::RBD::AioCompletion *)c;
|
||||
return librbd::aio_read(ictx, off, len, buf, NULL,
|
||||
// TODO: See if these tracepoints can be combined
|
||||
tracepoint(librbd, aio_read_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only, buf, comp->pc);
|
||||
tracepoint(librbd, aio_read_extent, off, len);
|
||||
int r = librbd::aio_read(ictx, off, len, buf, NULL,
|
||||
(librbd::AioCompletion *)comp->pc);
|
||||
tracepoint(librbd, aio_read_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
extern "C" int rbd_flush(rbd_image_t image)
|
||||
{
|
||||
librbd::ImageCtx *ictx = (librbd::ImageCtx *)image;
|
||||
return librbd::flush(ictx);
|
||||
tracepoint(librbd, flush_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only);
|
||||
int r = librbd::flush(ictx);
|
||||
tracepoint(librbd, flush_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
extern "C" int rbd_aio_flush(rbd_image_t image, rbd_completion_t c)
|
||||
{
|
||||
librbd::ImageCtx *ictx = (librbd::ImageCtx *)image;
|
||||
librbd::RBD::AioCompletion *comp = (librbd::RBD::AioCompletion *)c;
|
||||
return librbd::aio_flush(ictx, (librbd::AioCompletion *)comp->pc);
|
||||
tracepoint(librbd, aio_flush_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only, comp->pc);
|
||||
int r = librbd::aio_flush(ictx, (librbd::AioCompletion *)comp->pc);
|
||||
tracepoint(librbd, aio_flush_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
extern "C" int rbd_invalidate_cache(rbd_image_t image)
|
||||
{
|
||||
librbd::ImageCtx *ictx = (librbd::ImageCtx *)image;
|
||||
return librbd::invalidate_cache(ictx);
|
||||
tracepoint(librbd, invalidate_cache_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only);
|
||||
int r = librbd::invalidate_cache(ictx);
|
||||
tracepoint(librbd, invalidate_cache_exit, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
extern "C" int rbd_aio_is_complete(rbd_completion_t c)
|
||||
|
@ -101,61 +101,89 @@ TRACEPOINT_EVENT(librbd, close_image_exit,
|
||||
TP_FIELDS()
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, create_v1_enter,
|
||||
TRACEPOINT_EVENT(librbd, create_enter,
|
||||
TP_ARGS(
|
||||
const char*, pool_name,
|
||||
int64_t, id,
|
||||
const char*, imgname,
|
||||
uint64_t, bid,
|
||||
uint64_t, size,
|
||||
int, order),
|
||||
TP_FIELDS(
|
||||
ctf_string(pool_name, pool_name)
|
||||
ctf_integer(int64_t, id, id)
|
||||
ctf_string(imgname, imgname)
|
||||
ctf_integer(uint64_t, bid, bid)
|
||||
ctf_integer(uint64_t, size, size)
|
||||
ctf_integer(int, order, order)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, create_v1_exit,
|
||||
TRACEPOINT_EVENT(librbd, create_exit,
|
||||
TP_ARGS(
|
||||
int, retval),
|
||||
int, retval,
|
||||
int, order),
|
||||
TP_FIELDS(
|
||||
ctf_integer(int, retval, retval)
|
||||
ctf_integer(int, order, order)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, create_v2_enter,
|
||||
TRACEPOINT_EVENT(librbd, create2_enter,
|
||||
TP_ARGS(
|
||||
const char*, pool_name,
|
||||
int64_t, id,
|
||||
const char*, imgname,
|
||||
uint64_t, bid,
|
||||
uint64_t, size,
|
||||
int, order,
|
||||
uint64_t, features,
|
||||
int, order),
|
||||
TP_FIELDS(
|
||||
ctf_string(pool_name, pool_name)
|
||||
ctf_integer(int64_t, id, id)
|
||||
ctf_string(imgname, imgname)
|
||||
ctf_integer(uint64_t, size, size)
|
||||
ctf_integer(uint64_t, features, features)
|
||||
ctf_integer(int, order, order)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, create2_exit,
|
||||
TP_ARGS(
|
||||
int, retval,
|
||||
int, order),
|
||||
TP_FIELDS(
|
||||
ctf_integer(int, retval, retval)
|
||||
ctf_integer(int, order, order)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, create3_enter,
|
||||
TP_ARGS(
|
||||
const char*, pool_name,
|
||||
int64_t, id,
|
||||
const char*, imgname,
|
||||
uint64_t, size,
|
||||
uint64_t, features,
|
||||
int, order,
|
||||
uint64_t, stripe_unit,
|
||||
uint64_t, stripe_count),
|
||||
TP_FIELDS(
|
||||
ctf_string(pool_name, pool_name)
|
||||
ctf_integer(int64_t, id, id)
|
||||
ctf_string(imgname, imgname)
|
||||
ctf_integer(uint64_t, bid, bid)
|
||||
ctf_integer(uint64_t, size, size)
|
||||
ctf_integer(int, order, order)
|
||||
ctf_integer(uint64_t, features, features)
|
||||
ctf_integer(int, order, order)
|
||||
ctf_integer(uint64_t, stripe_unit, stripe_unit)
|
||||
ctf_integer(uint64_t, stripe_count, stripe_count)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, create_v2_exit,
|
||||
TRACEPOINT_EVENT(librbd, create3_exit,
|
||||
TP_ARGS(
|
||||
int, retval),
|
||||
int, retval,
|
||||
int, order),
|
||||
TP_FIELDS(
|
||||
ctf_integer(int, retval, retval)
|
||||
ctf_integer(int, order, order)
|
||||
)
|
||||
)
|
||||
|
||||
@ -341,6 +369,30 @@ TRACEPOINT_EVENT(librbd, aio_flush_exit,
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, copy_enter,
|
||||
TP_ARGS(
|
||||
void*, src_imagectx,
|
||||
const char*, src_name,
|
||||
const char*, src_snap_name,
|
||||
char, src_read_only,
|
||||
const char*, dst_name),
|
||||
TP_FIELDS(
|
||||
ctf_integer_hex(void*, src_imagectx, src_imagectx)
|
||||
ctf_string(src_name, src_name)
|
||||
ctf_string(src_snap_name, src_snap_name)
|
||||
ctf_integer(char, src_read_only, src_read_only)
|
||||
ctf_string(dst_name, dst_name)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, copy_exit,
|
||||
TP_ARGS(
|
||||
int, retval),
|
||||
TP_FIELDS(
|
||||
ctf_integer(int, retval, retval)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, copy2_enter,
|
||||
TP_ARGS(
|
||||
void*, src_imagectx,
|
||||
const char*, src_name,
|
||||
@ -362,7 +414,7 @@ TRACEPOINT_EVENT(librbd, copy_enter,
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(librbd, copy_exit,
|
||||
TRACEPOINT_EVENT(librbd, copy2_exit,
|
||||
TP_ARGS(
|
||||
int, retval),
|
||||
TP_FIELDS(
|
||||
|
Loading…
Reference in New Issue
Block a user