From: Haomai Wang Date: Tue, 16 Feb 2016 02:38:52 +0000 (+0800) Subject: librados: add C api impl and tracing codes X-Git-Tag: v10.1.0~321^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f977f0ab961c32012beb5d243eb4bf4554857138;p=ceph.git librados: add C api impl and tracing codes Signed-off-by: Haomai Wang --- diff --git a/src/librados/librados.cc b/src/librados/librados.cc index fffb787627e7..0c23e896a784 100644 --- a/src/librados/librados.cc +++ b/src/librados/librados.cc @@ -4223,6 +4223,30 @@ extern "C" int rados_watch2(rados_ioctx_t io, const char *o, uint64_t *handle, return ret; } +extern "C" int rados_aio_watch(rados_ioctx_t io, const char *o, + rados_completion_t completion, + uint64_t *handle, + rados_watchcb2_t watchcb, + rados_watcherrcb_t watcherrcb, void *arg) +{ + tracepoint(librados, rados_aio_watch_enter, io, o, completion, handle, watchcb, arg); + int ret; + if (!completion || !watchcb || !o || !handle) { + ret = -EINVAL; + } else { + uint64_t *cookie = handle; + librados::IoCtxImpl *ctx = (librados::IoCtxImpl *)io; + object_t oid(o); + librados::AioCompletionImpl *c = + reinterpret_cast(completion); + C_WatchCB2 *wc = new C_WatchCB2(watchcb, watcherrcb, arg); + ret = ctx->aio_watch(oid, c, cookie, NULL, wc); + } + tracepoint(librados, rados_watch_exit, ret, handle ? *handle : 0); + return ret; +} + + extern "C" int rados_unwatch(rados_ioctx_t io, const char *o, uint64_t handle) { tracepoint(librados, rados_unwatch_enter, io, o, handle); @@ -4243,6 +4267,19 @@ extern "C" int rados_unwatch2(rados_ioctx_t io, uint64_t handle) return retval; } +extern "C" int rados_aio_unwatch(rados_ioctx_t io, uint64_t handle, + rados_completion_t completion) +{ + tracepoint(librados, rados_aio_unwatch_enter, io, handle, completion); + uint64_t cookie = handle; + librados::IoCtxImpl *ctx = (librados::IoCtxImpl *)io; + librados::AioCompletionImpl *c = + reinterpret_cast(completion); + int retval = ctx->aio_unwatch(cookie, c); + tracepoint(librados, rados_aio_unwatch_exit, retval); + return retval; +} + extern "C" int rados_watch_check(rados_ioctx_t io, uint64_t handle) { tracepoint(librados, rados_watch_check_enter, io, handle); diff --git a/src/tracing/librados.tp b/src/tracing/librados.tp index 71717870830a..89ab0a67d323 100644 --- a/src/tracing/librados.tp +++ b/src/tracing/librados.tp @@ -2273,6 +2273,34 @@ TRACEPOINT_EVENT(librados, rados_watch2_exit, ) ) +TRACEPOINT_EVENT(librados, rados_aio_watch_enter, + TP_ARGS( + rados_ioctx_t, ioctx, + const char*, oid, + rados_completion_t, completion, + uint64_t*, phandle, + rados_watchcb2_t, callback, + void*, arg), + TP_FIELDS( + ctf_integer_hex(rados_ioctx_t, ioctx, ioctx) + ctf_string(oid, oid) + ctf_integer_hex(rados_completion_t, completion, completion) + ctf_integer_hex(uint64_t, phandle, phandle) + ctf_integer_hex(rados_watchcb2_t, callback, callback) + ctf_integer_hex(void*, arg, arg) + ) +) + +TRACEPOINT_EVENT(librados, rados_aio_watch_exit, + TP_ARGS( + int, retval, + uint64_t, handle), + TP_FIELDS( + ctf_integer(int, retval, retval) + ctf_integer(uint64_t, handle, handle) + ) +) + TRACEPOINT_EVENT(librados, rados_unwatch_enter, TP_ARGS( rados_ioctx_t, ioctx, @@ -2311,6 +2339,26 @@ TRACEPOINT_EVENT(librados, rados_unwatch2_exit, ) ) +TRACEPOINT_EVENT(librados, rados_aio_unwatch_enter, + TP_ARGS( + rados_ioctx_t, ioctx, + uint64_t, handle, + rados_completion_t, completion), + TP_FIELDS( + ctf_integer_hex(rados_ioctx_t, ioctx, ioctx) + ctf_integer(uint64_t, handle, handle) + ctf_integer_hex(rados_completion_t, completion, completion) + ) +) + +TRACEPOINT_EVENT(librados, rados_aio_unwatch_exit, + TP_ARGS( + int, retval), + TP_FIELDS( + ctf_integer(int, retval, retval) + ) +) + TRACEPOINT_EVENT(librados, rados_watch_check_enter, TP_ARGS( rados_ioctx_t, ioctx,