]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: add C api impl and tracing codes
authorHaomai Wang <haomai@xsky.com>
Tue, 16 Feb 2016 02:38:52 +0000 (10:38 +0800)
committerHaomai Wang <haomai@xsky.com>
Sat, 20 Feb 2016 06:22:44 +0000 (14:22 +0800)
Signed-off-by: Haomai Wang <haomai@xsky.com>
src/librados/librados.cc
src/tracing/librados.tp

index fffb787627e7d7b1e73f722f2a8dbd52645cc944..0c23e896a7848f94534735d4d6516f2f02fe01c9 100644 (file)
@@ -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<librados::AioCompletionImpl*>(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<librados::AioCompletionImpl*>(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);
index 71717870830aadef02cb10eab765dec091379df1..89ab0a67d323f2e630a377319e4c90e2f97762d3 100644 (file)
@@ -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,