diff --git a/src/include/rados/librados.h b/src/include/rados/librados.h index 15d9f217ec5..d1fb2795c55 100644 --- a/src/include/rados/librados.h +++ b/src/include/rados/librados.h @@ -1857,7 +1857,7 @@ typedef void (*rados_callback_t)(rados_completion_t cb, void *arg); * * @param cb_arg application-defined data passed to the callback functions * @param cb_complete the function to be called when the operation is - * in memory on all relpicas + * in memory on all replicas * @param cb_safe the function to be called when the operation is on * stable storage on all replicas * @param pc where to store the completion @@ -1868,6 +1868,23 @@ CEPH_RADOS_API int rados_aio_create_completion(void *cb_arg, rados_callback_t cb_safe, rados_completion_t *pc); +/** + * Constructs a completion to use with asynchronous operations + * + * The complete callback corresponds to operation being acked. + * + * @note BUG: this should check for ENOMEM instead of throwing an exception + * + * @param cb_arg application-defined data passed to the callback functions + * @param cb_complete the function to be called when the operation is committed + * on all replicas + * @param pc where to store the completion + * @returns 0 + */ +CEPH_RADOS_API int rados_aio_create_completion2(void *cb_arg, + rados_callback_t cb_complete, + rados_completion_t *pc); + /** * Block until an operation completes * diff --git a/src/librados/librados_c.cc b/src/librados/librados_c.cc index b334101b067..55f8d92098e 100644 --- a/src/librados/librados_c.cc +++ b/src/librados/librados_c.cc @@ -2240,6 +2240,20 @@ extern "C" int _rados_aio_create_completion(void *cb_arg, } LIBRADOS_C_API_BASE_DEFAULT(rados_aio_create_completion); +extern "C" int _rados_aio_create_completion2(void *cb_arg, + rados_callback_t cb_complete, + rados_completion_t *pc) +{ + tracepoint(librados, rados_aio_create_completion2_enter, cb_arg, cb_complete); + librados::AioCompletionImpl *c = new librados::AioCompletionImpl; + if (cb_complete) + c->set_complete_callback(cb_arg, cb_complete); + *pc = c; + tracepoint(librados, rados_aio_create_completion2_exit, 0, *pc); + return 0; +} +LIBRADOS_C_API_BASE_DEFAULT(rados_aio_create_completion2); + extern "C" int _rados_aio_wait_for_complete(rados_completion_t c) { tracepoint(librados, rados_aio_wait_for_complete_enter, c); diff --git a/src/tracing/librados.tp b/src/tracing/librados.tp index dfbd98b6b8a..5cfde1750a4 100644 --- a/src/tracing/librados.tp +++ b/src/tracing/librados.tp @@ -1991,6 +1991,26 @@ TRACEPOINT_EVENT(librados, rados_aio_create_completion_exit, ) ) +TRACEPOINT_EVENT(librados, rados_aio_create_completion2_enter, + TP_ARGS( + void*, cb_arg, + rados_callback_t, cb_complete), + TP_FIELDS( + ctf_integer_hex(void*, cb_arg, cb_arg) + ctf_integer_hex(rados_callback_t, cb_complete, cb_complete) + ) +) + +TRACEPOINT_EVENT(librados, rados_aio_create_completion2_exit, + TP_ARGS( + int, retval, + rados_completion_t, completion), + TP_FIELDS( + ctf_integer(int, retval, retval) + ctf_integer_hex(rados_completion_t, completion, completion) + ) +) + TRACEPOINT_EVENT(librados, rados_aio_wait_for_complete_enter, TP_ARGS( rados_completion_t, completion),