]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: expose op cancellation through AioCompletion::cancel()
authorCasey Bodley <cbodley@redhat.com>
Tue, 22 Oct 2024 18:00:06 +0000 (14:00 -0400)
committerCasey Bodley <cbodley@redhat.com>
Tue, 19 Nov 2024 13:35:27 +0000 (08:35 -0500)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
PendingReleaseNotes
src/include/rados/librados.hpp
src/librados/librados_cxx.cc

index 97a326aa71980f746d81cf703444d5ec544b0f3b..1f68c06cae32660fce117d8d7374f111e52aeac0 100644 (file)
@@ -34,6 +34,8 @@
   (--yes-i-really-mean-it). This has been added as a precaution to tell the
   users that modifying "max_mds" may not help with troubleshooting or recovery
   effort. Instead, it might further destabilize the cluster.
+* RADOS: Added convenience function `librados::AioCompletion::cancel()` with
+  the same behavior as `librados::IoCtx::aio_cancel()`.
 
 * mgr/restful, mgr/zabbix: both modules, already deprecated since 2020, have been
   finally removed. They have not been actively maintenance in the last years,
index 4a7ac3ea6e0a7fe5789fa3665810bf7c04eed9ad..9041ae422cc1e742ba5df784b8849d899d4bb33d 100644 (file)
@@ -202,6 +202,9 @@ inline namespace v14_2_0 {
     int set_complete_callback(void *cb_arg, callback_t cb);
     int set_safe_callback(void *cb_arg, callback_t cb)
       __attribute__ ((deprecated));
+    /// Request immediate cancellation with error code -ECANCELED
+    /// if the operation hasn't already completed.
+    int cancel();
     int wait_for_complete();
     int wait_for_safe() __attribute__ ((deprecated));
     int wait_for_complete_and_cb();
index 2167eeade3c2d17aacc98b9672f5f5a6d5d7981d..60217b99b4149f44c6c4947d1bf7aa1010cf784f 100644 (file)
@@ -1103,6 +1103,14 @@ void librados::AioCompletion::release()
   delete this;
 }
 
+int librados::AioCompletion::cancel()
+{
+  if (!pc->io) {
+    return 0; // no operation was started
+  }
+  return pc->io->aio_cancel(pc);
+}
+
 ///////////////////////////// IoCtx //////////////////////////////
 librados::IoCtx::IoCtx() : io_ctx_impl(NULL)
 {