From: Casey Bodley Date: Tue, 23 May 2023 17:24:42 +0000 (-0400) Subject: librados: add rados_aio_write_op_operate2() for high-resolution timestamps X-Git-Tag: v18.1.2~11^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=9a0da1816282ac932f0973f87c240fb3799fdd9f;p=ceph-ci.git librados: add rados_aio_write_op_operate2() for high-resolution timestamps expose the aio version of rados_write_op_operate2() for mtimes in timespec form Signed-off-by: Casey Bodley (cherry picked from commit 7d58f1832d8d8bc1148240d347be85850b86adfa) --- diff --git a/src/include/rados/librados.h b/src/include/rados/librados.h index e40dc466536..858804c3a03 100644 --- a/src/include/rados/librados.h +++ b/src/include/rados/librados.h @@ -3226,6 +3226,22 @@ CEPH_RADOS_API int rados_aio_write_op_operate(rados_write_op_t write_op, time_t *mtime, int flags); +/** + * Perform a write operation asynchronously + * @param write_op operation to perform + * @param io the ioctx that the object is in + * @param completion what to do when operation has been attempted + * @param oid the object id + * @param mtime the time to set the mtime to, NULL for the current time + * @param flags flags to apply to the entire operation (LIBRADOS_OPERATION_*) + */ +CEPH_RADOS_API int rados_aio_write_op_operate2(rados_write_op_t write_op, + rados_ioctx_t io, + rados_completion_t completion, + const char *oid, + struct timespec *mtime, + int flags); + /** * Create a new rados_read_op_t read operation. This will store all * actions to be performed atomically. You must call diff --git a/src/librados/librados_c.cc b/src/librados/librados_c.cc index e88d067cae6..a0eb6e08c52 100644 --- a/src/librados/librados_c.cc +++ b/src/librados/librados_c.cc @@ -4059,6 +4059,31 @@ extern "C" int LIBRADOS_C_API_DEFAULT_F(rados_aio_write_op_operate)( } LIBRADOS_C_API_BASE_DEFAULT(rados_aio_write_op_operate); +extern "C" int LIBRADOS_C_API_DEFAULT_F(rados_aio_write_op_operate2)( + rados_write_op_t write_op, + rados_ioctx_t io, + rados_completion_t completion, + const char *oid, + struct timespec *mtime, + int flags) +{ + tracepoint(librados, rados_aio_write_op_operate2_enter, write_op, io, completion, oid, mtime, flags); + object_t obj(oid); + auto oimpl = static_cast(write_op); + librados::IoCtxImpl *ctx = (librados::IoCtxImpl *)io; + librados::AioCompletionImpl *c = (librados::AioCompletionImpl*)completion; + + if (mtime) { + oimpl->rt = ceph::real_clock::from_timespec(*mtime); + oimpl->prt = &oimpl->rt; + } + + int retval = ctx->aio_operate(obj, &oimpl->o, c, ctx->snapc, oimpl->prt, translate_flags(flags)); + tracepoint(librados, rados_aio_write_op_operate_exit, retval); + return retval; +} +LIBRADOS_C_API_BASE_DEFAULT(rados_aio_write_op_operate2); + extern "C" rados_read_op_t LIBRADOS_C_API_DEFAULT_F(rados_create_read_op)() { tracepoint(librados, rados_create_read_op_enter); diff --git a/src/tracing/librados.tp b/src/tracing/librados.tp index 42559097b84..8b5e78ef15d 100644 --- a/src/tracing/librados.tp +++ b/src/tracing/librados.tp @@ -3597,6 +3597,24 @@ TRACEPOINT_EVENT(librados, rados_aio_write_op_operate_enter, ) ) +TRACEPOINT_EVENT(librados, rados_aio_write_op_operate2_enter, + TP_ARGS( + rados_write_op_t, op, + rados_ioctx_t, ioctx, + rados_completion_t, completion, + const char*, oid, + struct timespec*, ts, + int, flags), + TP_FIELDS( + ctf_integer_hex(rados_write_op_t, op, op) + ctf_integer_hex(rados_ioctx_t, ioctx, ioctx) + ctf_integer_hex(rados_completion_t, completion, completion) + ctf_string(oid, oid) + ceph_ctf_timespecp(ts, ts) + ctf_integer_hex(int, flags, flags) + ) +) + TRACEPOINT_EVENT(librados, rados_aio_write_op_operate_exit, TP_ARGS( int, retval),