mirror of
https://github.com/ceph/ceph
synced 2025-02-19 00:47:49 +00:00
librados: add rados_aio_create_completion2()
rados_aio_create_completion2() is almost identical to
rados_aio_create_completion(). the only difference is that the former
does not accept the `safe` callback. as it's an alias of `complete`
callback since af01db76f6
Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
parent
46fa68eb10
commit
c2d6788aaa
@ -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
|
||||
*
|
||||
|
@ -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);
|
||||
|
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user