]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: created new api::Io helper methods
authorJason Dillaman <dillaman@redhat.com>
Tue, 5 May 2020 20:02:58 +0000 (16:02 -0400)
committerJason Dillaman <dillaman@redhat.com>
Thu, 14 May 2020 15:56:45 +0000 (11:56 -0400)
These will be invoked by the user API and wrap various user API
specific logic.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
16 files changed:
src/librbd/CMakeLists.txt
src/librbd/api/DiffIterate.cc
src/librbd/api/Io.cc [new file with mode: 0644]
src/librbd/api/Io.h [new file with mode: 0644]
src/librbd/exclusive_lock/ImageDispatch.cc
src/librbd/image/CloseRequest.cc
src/librbd/image/RefreshRequest.cc
src/librbd/io/ImageDispatchSpec.h
src/librbd/io/ImageRequestWQ.cc
src/librbd/io/QueueImageDispatch.cc
src/librbd/operation/ResizeRequest.cc
src/test/librbd/image/test_mock_RefreshRequest.cc
src/test/librbd/io/test_mock_ImageRequestWQ.cc
src/test/librbd/journal/test_Replay.cc
src/test/librbd/operation/test_mock_ResizeRequest.cc
src/test/rbd_mirror/test_ImageSync.cc

index fe914202f3d6c96505892dc899059544eabaf2d7..746e1a6cdb2870b921a9345ec27a5127195701a6 100644 (file)
@@ -27,6 +27,7 @@ set(librbd_internal_srcs
   api/DiffIterate.cc
   api/Group.cc
   api/Image.cc
+  api/Io.cc
   api/Migration.cc
   api/Mirror.cc
   api/Namespace.cc
index d0dffb11dfd8407ab2648363820cdd54fa10b5cb..a5419e05e831fe6740d9083dc52832437f89beef 100644 (file)
@@ -250,7 +250,7 @@ int DiffIterate<I>::diff_iterate(I *ictx,
     std::shared_lock owner_locker{ictx->owner_lock};
     auto aio_comp = io::AioCompletion::create_and_start(&flush_ctx, ictx,
                                                         io::AIO_TYPE_FLUSH);
-    auto req = io::ImageDispatchSpec<I>::create_flush_request(
+    auto req = io::ImageDispatchSpec<I>::create_flush(
       *ictx, io::IMAGE_DISPATCH_LAYER_INTERNAL_START,
       aio_comp, io::FLUSH_SOURCE_INTERNAL, {});
     req->send();
diff --git a/src/librbd/api/Io.cc b/src/librbd/api/Io.cc
new file mode 100644 (file)
index 0000000..b1de301
--- /dev/null
@@ -0,0 +1,372 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#include "librbd/api/Io.h"
+#include "common/dout.h"
+#include "common/errno.h"
+#include "common/Cond.h"
+#include "common/EventTrace.h"
+#include "librbd/ImageCtx.h"
+#include "librbd/internal.h"
+#include "librbd/Utils.h"
+#include "librbd/io/AioCompletion.h"
+#include "librbd/io/ImageDispatchSpec.h"
+#include "librbd/io/Types.h"
+
+#define dout_subsys ceph_subsys_rbd
+#undef dout_prefix
+#define dout_prefix *_dout << "librbd::api::Io " << __func__ << ": "
+
+namespace librbd {
+namespace api {
+
+namespace {
+
+template <typename I>
+bool is_valid_io(I& image_ctx, io::AioCompletion* aio_comp) {
+  auto cct = image_ctx.cct;
+
+  if (!image_ctx.data_ctx.is_valid()) {
+    lderr(cct) << "missing data pool" << dendl;
+
+    aio_comp->fail(-ENODEV);
+    return false;
+  }
+
+  return true;
+}
+
+} // anonymous namespace
+
+template <typename I>
+ssize_t Io<I>::read(
+    I &image_ctx, uint64_t off, uint64_t len, io::ReadResult &&read_result,
+    int op_flags) {
+  auto cct = image_ctx.cct;
+
+  ldout(cct, 20) << "ictx=" << &image_ctx << ", off=" << off << ", "
+                 << "len = " << len << dendl;
+
+  C_SaferCond ctx;
+  auto aio_comp = io::AioCompletion::create(&ctx);
+  aio_read(image_ctx, aio_comp, off, len, std::move(read_result), op_flags,
+           false);
+  return ctx.wait();
+}
+
+template <typename I>
+ssize_t Io<I>::write(
+    I &image_ctx, uint64_t off, uint64_t len, bufferlist &&bl, int op_flags) {
+  auto cct = image_ctx.cct;
+  ldout(cct, 20) << "ictx=" << &image_ctx << ", off=" << off << ", "
+                 << "len = " << len << dendl;
+
+  image_ctx.image_lock.lock_shared();
+  int r = clip_io(util::get_image_ctx(&image_ctx), off, &len);
+  image_ctx.image_lock.unlock_shared();
+  if (r < 0) {
+    lderr(cct) << "invalid IO request: " << cpp_strerror(r) << dendl;
+    return r;
+  }
+
+  C_SaferCond ctx;
+  auto aio_comp = io::AioCompletion::create(&ctx);
+  aio_write(image_ctx, aio_comp, off, len, std::move(bl), op_flags, false);
+
+  r = ctx.wait();
+  if (r < 0) {
+    return r;
+  }
+  return len;
+}
+
+template <typename I>
+ssize_t Io<I>::discard(
+    I &image_ctx, uint64_t off, uint64_t len,
+    uint32_t discard_granularity_bytes) {
+  auto cct = image_ctx.cct;
+  ldout(cct, 20) << "ictx=" << &image_ctx << ", off=" << off << ", "
+                 << "len = " << len << dendl;
+
+  image_ctx.image_lock.lock_shared();
+  int r = clip_io(util::get_image_ctx(&image_ctx), off, &len);
+  image_ctx.image_lock.unlock_shared();
+  if (r < 0) {
+    lderr(cct) << "invalid IO request: " << cpp_strerror(r) << dendl;
+    return r;
+  }
+
+  C_SaferCond ctx;
+  auto aio_comp = io::AioCompletion::create(&ctx);
+  aio_discard(image_ctx, aio_comp, off, len, discard_granularity_bytes, false);
+
+  r = ctx.wait();
+  if (r < 0) {
+    return r;
+  }
+  return len;
+}
+
+template <typename I>
+ssize_t Io<I>::write_same(
+    I &image_ctx, uint64_t off, uint64_t len, bufferlist &&bl, int op_flags) {
+  auto cct = image_ctx.cct;
+  ldout(cct, 20) << "ictx=" << &image_ctx << ", off=" << off << ", "
+                 << "len = " << len << ", data_len " << bl.length() << dendl;
+
+  image_ctx.image_lock.lock_shared();
+  int r = clip_io(util::get_image_ctx(&image_ctx), off, &len);
+  image_ctx.image_lock.unlock_shared();
+  if (r < 0) {
+    lderr(cct) << "invalid IO request: " << cpp_strerror(r) << dendl;
+    return r;
+  }
+
+  C_SaferCond ctx;
+  auto aio_comp = io::AioCompletion::create(&ctx);
+  aio_write_same(image_ctx, aio_comp, off, len, std::move(bl), op_flags, false);
+
+  r = ctx.wait();
+  if (r < 0) {
+    return r;
+  }
+  return len;
+}
+
+template <typename I>
+ssize_t Io<I>::compare_and_write(
+    I &image_ctx, uint64_t off, uint64_t len, bufferlist &&cmp_bl,
+    bufferlist &&bl, uint64_t *mismatch_off, int op_flags) {
+  auto cct = image_ctx.cct;
+  ldout(cct, 20) << "compare_and_write ictx=" << &image_ctx << ", off="
+                 << off << ", " << "len = " << len << dendl;
+
+  image_ctx.image_lock.lock_shared();
+  int r = clip_io(util::get_image_ctx(&image_ctx), off, &len);
+  image_ctx.image_lock.unlock_shared();
+  if (r < 0) {
+    lderr(cct) << "invalid IO request: " << cpp_strerror(r) << dendl;
+    return r;
+  }
+
+  C_SaferCond ctx;
+  auto aio_comp = io::AioCompletion::create(&ctx);
+  aio_compare_and_write(image_ctx, aio_comp, off, len, std::move(cmp_bl),
+                        std::move(bl), mismatch_off, op_flags, false);
+
+  r = ctx.wait();
+  if (r < 0) {
+    return r;
+  }
+  return len;
+}
+
+template <typename I>
+int Io<I>::flush(I &image_ctx) {
+  auto cct = image_ctx.cct;
+  ldout(cct, 20) << "ictx=" << &image_ctx << dendl;
+
+  C_SaferCond ctx;
+  auto aio_comp = io::AioCompletion::create(&ctx);
+  aio_flush(image_ctx, aio_comp, false);
+
+  int r = ctx.wait();
+  if (r < 0) {
+    return r;
+  }
+
+  return 0;
+}
+
+template <typename I>
+void Io<I>::aio_read(I &image_ctx, io::AioCompletion *aio_comp, uint64_t off,
+                     uint64_t len, io::ReadResult &&read_result, int op_flags,
+                     bool native_async) {
+  auto cct = image_ctx.cct;
+  FUNCTRACE(cct);
+  ZTracer::Trace trace;
+  if (image_ctx.blkin_trace_all) {
+    trace.init("wq: read", &image_ctx.trace_endpoint);
+    trace.event("start");
+  }
+
+  aio_comp->init_time(util::get_image_ctx(&image_ctx), io::AIO_TYPE_READ);
+  ldout(cct, 20) << "ictx=" << &image_ctx << ", "
+                 << "completion=" << aio_comp << ", off=" << off << ", "
+                 << "len=" << len << ", " << "flags=" << op_flags << dendl;
+
+  if (native_async && image_ctx.event_socket.is_valid()) {
+    aio_comp->set_event_notify(true);
+  }
+
+  if (!is_valid_io(image_ctx, aio_comp)) {
+    return;
+  }
+
+  auto req = io::ImageDispatchSpec<I>::create_read(
+    image_ctx, io::IMAGE_DISPATCH_LAYER_API_START, aio_comp, {{off, len}},
+    std::move(read_result), op_flags, {});
+  req->send();
+}
+
+template <typename I>
+void Io<I>::aio_write(I &image_ctx, io::AioCompletion *aio_comp, uint64_t off,
+                      uint64_t len, bufferlist &&bl, int op_flags,
+                      bool native_async) {
+  auto cct = image_ctx.cct;
+  FUNCTRACE(cct);
+  ZTracer::Trace trace;
+  if (image_ctx.blkin_trace_all) {
+    trace.init("wq: write", &image_ctx.trace_endpoint);
+    trace.event("init");
+  }
+
+  aio_comp->init_time(util::get_image_ctx(&image_ctx), io::AIO_TYPE_WRITE);
+  ldout(cct, 20) << "ictx=" << &image_ctx << ", "
+                 << "completion=" << aio_comp << ", off=" << off << ", "
+                 << "len=" << len << ", flags=" << op_flags << dendl;
+
+  if (native_async && image_ctx.event_socket.is_valid()) {
+    aio_comp->set_event_notify(true);
+  }
+
+  if (!is_valid_io(image_ctx, aio_comp)) {
+    return;
+  }
+
+  auto req = io::ImageDispatchSpec<I>::create_write(
+    image_ctx, io::IMAGE_DISPATCH_LAYER_API_START, aio_comp, {{off, len}},
+    std::move(bl), op_flags, {}, 0);
+  req->send();
+}
+
+template <typename I>
+void Io<I>::aio_discard(I &image_ctx, io::AioCompletion *aio_comp, uint64_t off,
+                        uint64_t len, uint32_t discard_granularity_bytes,
+                        bool native_async) {
+  auto cct = image_ctx.cct;
+  FUNCTRACE(cct);
+  ZTracer::Trace trace;
+  if (image_ctx.blkin_trace_all) {
+    trace.init("wq: discard", &image_ctx.trace_endpoint);
+    trace.event("init");
+  }
+
+  aio_comp->init_time(util::get_image_ctx(&image_ctx), io::AIO_TYPE_DISCARD);
+  ldout(cct, 20) << "ictx=" << &image_ctx << ", "
+                 << "completion=" << aio_comp << ", off=" << off << ", "
+                 << "len=" << len << dendl;
+
+  if (native_async && image_ctx.event_socket.is_valid()) {
+    aio_comp->set_event_notify(true);
+  }
+
+  if (!is_valid_io(image_ctx, aio_comp)) {
+    return;
+  }
+
+  auto req = io::ImageDispatchSpec<I>::create_discard(
+    image_ctx, io::IMAGE_DISPATCH_LAYER_API_START, aio_comp, off, len,
+    discard_granularity_bytes, {}, 0);
+  req->send();
+}
+
+template <typename I>
+void Io<I>::aio_write_same(I &image_ctx, io::AioCompletion *aio_comp,
+                           uint64_t off, uint64_t len, bufferlist &&bl,
+                           int op_flags, bool native_async) {
+  auto cct = image_ctx.cct;
+  FUNCTRACE(cct);
+  ZTracer::Trace trace;
+  if (image_ctx.blkin_trace_all) {
+    trace.init("wq: writesame", &image_ctx.trace_endpoint);
+    trace.event("init");
+  }
+
+  aio_comp->init_time(util::get_image_ctx(&image_ctx), io::AIO_TYPE_WRITESAME);
+  ldout(cct, 20) << "ictx=" << &image_ctx << ", "
+                 << "completion=" << aio_comp << ", off=" << off << ", "
+                 << "len=" << len << ", data_len = " << bl.length() << ", "
+                 << "flags=" << op_flags << dendl;
+
+  if (native_async && image_ctx.event_socket.is_valid()) {
+    aio_comp->set_event_notify(true);
+  }
+
+  if (!is_valid_io(image_ctx, aio_comp)) {
+    return;
+  }
+
+  auto req = io::ImageDispatchSpec<I>::create_write_same(
+    image_ctx, io::IMAGE_DISPATCH_LAYER_API_START, aio_comp, off, len,
+    std::move(bl), op_flags, {}, 0);
+  req->send();
+}
+
+template <typename I>
+void Io<I>::aio_compare_and_write(I &image_ctx, io::AioCompletion *aio_comp,
+                                  uint64_t off, uint64_t len,
+                                  bufferlist &&cmp_bl,
+                                  bufferlist &&bl, uint64_t *mismatch_off,
+                                  int op_flags, bool native_async) {
+  auto cct = image_ctx.cct;
+  FUNCTRACE(cct);
+  ZTracer::Trace trace;
+  if (image_ctx.blkin_trace_all) {
+    trace.init("wq: compare_and_write", &image_ctx.trace_endpoint);
+    trace.event("init");
+  }
+
+  aio_comp->init_time(util::get_image_ctx(&image_ctx),
+                      io::AIO_TYPE_COMPARE_AND_WRITE);
+  ldout(cct, 20) << "ictx=" << &image_ctx << ", "
+                 << "completion=" << aio_comp << ", off=" << off << ", "
+                 << "len=" << len << dendl;
+
+  if (native_async && image_ctx.event_socket.is_valid()) {
+    aio_comp->set_event_notify(true);
+  }
+
+  if (!is_valid_io(image_ctx, aio_comp)) {
+    return;
+  }
+
+  auto req = io::ImageDispatchSpec<I>::create_compare_and_write(
+    image_ctx, io::IMAGE_DISPATCH_LAYER_API_START, aio_comp, {{off, len}},
+    std::move(cmp_bl), std::move(bl), mismatch_off, op_flags, {}, 0);
+  req->send();
+}
+
+template <typename I>
+void Io<I>::aio_flush(I &image_ctx, io::AioCompletion *aio_comp,
+                      bool native_async) {
+  auto cct = image_ctx.cct;
+  FUNCTRACE(cct);
+  ZTracer::Trace trace;
+  if (image_ctx.blkin_trace_all) {
+    trace.init("wq: flush", &image_ctx.trace_endpoint);
+    trace.event("init");
+  }
+
+  aio_comp->init_time(util::get_image_ctx(&image_ctx), io::AIO_TYPE_FLUSH);
+  ldout(cct, 20) << "ictx=" << &image_ctx << ", "
+                 << "completion=" << aio_comp << dendl;
+
+  if (native_async && image_ctx.event_socket.is_valid()) {
+    aio_comp->set_event_notify(true);
+  }
+
+  if (!is_valid_io(image_ctx, aio_comp)) {
+    return;
+  }
+
+  auto req = io::ImageDispatchSpec<I>::create_flush(
+    image_ctx, io::IMAGE_DISPATCH_LAYER_API_START, aio_comp,
+    io::FLUSH_SOURCE_USER, {});
+  req->send();
+}
+
+} // namespace api
+} // namespace librbd
+
+template class librbd::api::Io<librbd::ImageCtx>;
diff --git a/src/librbd/api/Io.h b/src/librbd/api/Io.h
new file mode 100644 (file)
index 0000000..95120d4
--- /dev/null
@@ -0,0 +1,60 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#ifndef LIBRBD_API_IO_H
+#define LIBRBD_API_IO_H
+
+#include "include/int_types.h"
+#include "librbd/io/ReadResult.h"
+
+namespace librbd {
+
+struct ImageCtx;
+namespace io { struct AioCompletion; }
+
+namespace api {
+
+template<typename ImageCtxT = ImageCtx>
+struct Io {
+  static ssize_t read(ImageCtxT &image_ctx, uint64_t off, uint64_t len,
+                      io::ReadResult &&read_result, int op_flags);
+  static ssize_t write(ImageCtxT &image_ctx, uint64_t off, uint64_t len,
+                       bufferlist &&bl, int op_flags);
+  static ssize_t discard(ImageCtxT &image_ctx, uint64_t off, uint64_t len,
+                         uint32_t discard_granularity_bytes);
+  static ssize_t write_same(ImageCtxT &image_ctx, uint64_t off, uint64_t len,
+                            bufferlist &&bl, int op_flags);
+  static ssize_t compare_and_write(ImageCtxT &image_ctx, uint64_t off,
+                                   uint64_t len, bufferlist &&cmp_bl,
+                                   bufferlist &&bl, uint64_t *mismatch_off,
+                                   int op_flags);
+  static int flush(ImageCtxT &image_ctx);
+
+  static void aio_read(ImageCtxT &image_ctx, io::AioCompletion *c, uint64_t off,
+                       uint64_t len, io::ReadResult &&read_result, int op_flags,
+                       bool native_async);
+  static void aio_write(ImageCtxT &image_ctx, io::AioCompletion *c,
+                        uint64_t off, uint64_t len, bufferlist &&bl,
+                        int op_flags, bool native_async);
+  static void aio_discard(ImageCtxT &image_ctx, io::AioCompletion *c,
+                          uint64_t off, uint64_t len,
+                          uint32_t discard_granularity_bytes,
+                          bool native_async);
+  static void aio_write_same(ImageCtxT &image_ctx, io::AioCompletion *c,
+                             uint64_t off, uint64_t len, bufferlist &&bl,
+                             int op_flags, bool native_async);
+  static void aio_compare_and_write(ImageCtxT &image_ctx, io::AioCompletion *c,
+                                    uint64_t off, uint64_t len,
+                                    bufferlist &&cmp_bl, bufferlist &&bl,
+                                    uint64_t *mismatch_off, int op_flags,
+                                    bool native_async);
+  static void aio_flush(ImageCtxT &image_ctx, io::AioCompletion *c,
+                        bool native_async);
+};
+
+} // namespace api
+} // namespace librbd
+
+extern template class librbd::api::Io<librbd::ImageCtx>;
+
+#endif // LIBRBD_API_IO_H
index 087286f84c2b0ae189af4fc479ba7897c56a0761..70fc0777364a1b30e57dfcf7374d9b7851ab78b3 100644 (file)
@@ -78,7 +78,7 @@ void ImageDispatch<I>::set_require_lock(io::Direction direction,
     // push through an flush for any in-flight writes at lower levels
     auto aio_comp = io::AioCompletion::create_and_start(
       ctx->new_sub(), util::get_image_ctx(m_image_ctx), io::AIO_TYPE_FLUSH);
-    auto req = io::ImageDispatchSpec<I>::create_flush_request(
+    auto req = io::ImageDispatchSpec<I>::create_flush(
       *m_image_ctx, io::IMAGE_DISPATCH_LAYER_EXCLUSIVE_LOCK, aio_comp,
       io::FLUSH_SOURCE_INTERNAL, {});
     req->send();
index 9296e42da91c644e4ba9b2a710bcf2f2e6f5bb73..0ddcfb82fa2027f84f3427838dee348ee63c7230 100644 (file)
@@ -168,7 +168,7 @@ void CloseRequest<I>::send_flush() {
     CloseRequest<I>, &CloseRequest<I>::handle_flush>(this);
   auto aio_comp = io::AioCompletion::create_and_start(ctx, m_image_ctx,
                                                       io::AIO_TYPE_FLUSH);
-  auto req = io::ImageDispatchSpec<I>::create_flush_request(
+  auto req = io::ImageDispatchSpec<I>::create_flush(
     *m_image_ctx, io::IMAGE_DISPATCH_LAYER_INTERNAL_START, aio_comp,
     io::FLUSH_SOURCE_INTERNAL, {});
   req->send();
index 25c30816711ba113771c4def444d89b8430fc534..2ced9c8b1af2a4cf8cfd05811ead4eeddcc6374f 100644 (file)
@@ -1229,7 +1229,7 @@ Context *RefreshRequest<I>::send_flush_aio() {
       RefreshRequest<I>, &RefreshRequest<I>::handle_flush_aio>(this);
     auto aio_comp = io::AioCompletion::create_and_start(
       ctx, util::get_image_ctx(&m_image_ctx), io::AIO_TYPE_FLUSH);
-    auto req = io::ImageDispatchSpec<I>::create_flush_request(
+    auto req = io::ImageDispatchSpec<I>::create_flush(
       m_image_ctx, io::IMAGE_DISPATCH_LAYER_INTERNAL_START, aio_comp,
       io::FLUSH_SOURCE_INTERNAL, {});
     req->send();
index e489e94b23a4af94bc3f0e5a180d0ef5c4c6a9f8..1c12f3afcb48e491f844c058604aac1176b6b868 100644 (file)
@@ -107,7 +107,7 @@ public:
   ZTracer::Trace parent_trace;
   uint64_t tid;
 
-  static ImageDispatchSpec* create_read_request(
+  static ImageDispatchSpec* create_read(
       ImageCtxT &image_ctx, ImageDispatchLayer image_dispatch_layer,
       AioCompletion *aio_comp, Extents &&image_extents,
       ReadResult &&read_result, int op_flags,
@@ -118,7 +118,7 @@ public:
                                  op_flags, parent_trace, 0);
   }
 
-  static ImageDispatchSpec* create_discard_request(
+  static ImageDispatchSpec* create_discard(
       ImageCtxT &image_ctx, ImageDispatchLayer image_dispatch_layer,
       AioCompletion *aio_comp, uint64_t off, uint64_t len,
       uint32_t discard_granularity_bytes, const ZTracer::Trace &parent_trace,
@@ -129,7 +129,7 @@ public:
                                  0, parent_trace, tid);
   }
 
-  static ImageDispatchSpec* create_write_request(
+  static ImageDispatchSpec* create_write(
       ImageCtxT &image_ctx, ImageDispatchLayer image_dispatch_layer,
       AioCompletion *aio_comp, Extents &&image_extents,
       bufferlist &&bl, int op_flags, const ZTracer::Trace &parent_trace,
@@ -139,7 +139,7 @@ public:
                                  op_flags, parent_trace, tid);
   }
 
-  static ImageDispatchSpec* create_write_same_request(
+  static ImageDispatchSpec* create_write_same(
       ImageCtxT &image_ctx, ImageDispatchLayer image_dispatch_layer,
       AioCompletion *aio_comp, uint64_t off, uint64_t len,
       bufferlist &&bl, int op_flags, const ZTracer::Trace &parent_trace,
@@ -149,7 +149,7 @@ public:
                                  op_flags, parent_trace, tid);
   }
 
-  static ImageDispatchSpec* create_compare_and_write_request(
+  static ImageDispatchSpec* create_compare_and_write(
       ImageCtxT &image_ctx, ImageDispatchLayer image_dispatch_layer,
       AioCompletion *aio_comp, Extents &&image_extents,
       bufferlist &&cmp_bl, bufferlist &&bl, uint64_t *mismatch_offset,
@@ -162,7 +162,7 @@ public:
                                  op_flags, parent_trace, tid);
   }
 
-  static ImageDispatchSpec* create_flush_request(
+  static ImageDispatchSpec* create_flush(
       ImageCtxT &image_ctx, ImageDispatchLayer image_dispatch_layer,
       AioCompletion *aio_comp, FlushSource flush_source,
       const ZTracer::Trace &parent_trace) {
index 4172179286b6383f835c2267fa47175d25d86514..dbd558bdc40306320cc68212e7508bbcbd45c68e 100644 (file)
@@ -252,7 +252,7 @@ void ImageRequestWQ<I>::aio_read(AioCompletion *c, uint64_t off, uint64_t len,
   std::shared_lock owner_locker{m_image_ctx.owner_lock};
   if (m_image_ctx.non_blocking_aio || writes_blocked() || !writes_empty() ||
       require_lock_on_read()) {
-    queue(ImageDispatchSpec<I>::create_read_request(
+    queue(ImageDispatchSpec<I>::create_read(
             m_image_ctx, IMAGE_DISPATCH_LAYER_API_START, c, {{off, len}},
             std::move(read_result), op_flags, trace));
   } else {
@@ -296,7 +296,7 @@ void ImageRequestWQ<I>::aio_write(AioCompletion *c, uint64_t off, uint64_t len,
     m_queued_or_blocked_io_tids.insert(tid);
   }
 
-  ImageDispatchSpec<I> *req = ImageDispatchSpec<I>::create_write_request(
+  ImageDispatchSpec<I> *req = ImageDispatchSpec<I>::create_write(
     m_image_ctx, IMAGE_DISPATCH_LAYER_API_START, c, {{off, len}}, std::move(bl),
     op_flags, trace, tid);
 
@@ -338,7 +338,7 @@ void ImageRequestWQ<I>::aio_discard(AioCompletion *c, uint64_t off,
     m_queued_or_blocked_io_tids.insert(tid);
   }
 
-  ImageDispatchSpec<I> *req = ImageDispatchSpec<I>::create_discard_request(
+  ImageDispatchSpec<I> *req = ImageDispatchSpec<I>::create_discard(
     m_image_ctx, IMAGE_DISPATCH_LAYER_API_START, c, off, len,
     discard_granularity_bytes, trace, tid);
 
@@ -371,7 +371,7 @@ void ImageRequestWQ<I>::aio_flush(AioCompletion *c, bool native_async) {
 
   auto tid = ++m_last_tid;
 
-  ImageDispatchSpec<I> *req = ImageDispatchSpec<I>::create_flush_request(
+  ImageDispatchSpec<I> *req = ImageDispatchSpec<I>::create_flush(
     m_image_ctx, IMAGE_DISPATCH_LAYER_API_START, c, FLUSH_SOURCE_USER, trace);
 
   {
@@ -422,7 +422,7 @@ void ImageRequestWQ<I>::aio_writesame(AioCompletion *c, uint64_t off,
     m_queued_or_blocked_io_tids.insert(tid);
   }
 
-  ImageDispatchSpec<I> *req = ImageDispatchSpec<I>::create_write_same_request(
+  ImageDispatchSpec<I> *req = ImageDispatchSpec<I>::create_write_same(
     m_image_ctx, IMAGE_DISPATCH_LAYER_API_START, c, off, len, std::move(bl),
     op_flags, trace, tid);
 
@@ -466,7 +466,7 @@ void ImageRequestWQ<I>::aio_compare_and_write(AioCompletion *c,
     m_queued_or_blocked_io_tids.insert(tid);
   }
 
-  ImageDispatchSpec<I> *req = ImageDispatchSpec<I>::create_compare_and_write_request(
+  ImageDispatchSpec<I> *req = ImageDispatchSpec<I>::create_compare_and_write(
     m_image_ctx, IMAGE_DISPATCH_LAYER_API_START, c, {{off, len}},
     std::move(cmp_bl), std::move(bl), mismatch_off, op_flags, trace, tid);
 
index 4ca31a4b9674db3d4ea3dae7c40fa0ab64e07a09..1b370d08b1503e81a323ba9893d453d5b4c6cdd6 100644 (file)
@@ -256,7 +256,7 @@ template <typename I>
 void QueueImageDispatch<I>::flush_image(Context* on_finish) {
   auto aio_comp = AioCompletion::create_and_start(
     on_finish, util::get_image_ctx(m_image_ctx), librbd::io::AIO_TYPE_FLUSH);
-  auto req = ImageDispatchSpec<I>::create_flush_request(
+  auto req = ImageDispatchSpec<I>::create_flush(
     *m_image_ctx, IMAGE_DISPATCH_LAYER_QUEUE, aio_comp, FLUSH_SOURCE_INTERNAL,
     {});
   req->send();
index 4d8c51bb2a3cd653bdc402516bbd8febbfb0e4d0..d90b81fe9740789314f14ac0eb8070392fa303be 100644 (file)
@@ -196,7 +196,7 @@ void ResizeRequest<I>::send_flush_cache() {
     ResizeRequest<I>, &ResizeRequest<I>::handle_flush_cache>(this);
   auto aio_comp = io::AioCompletion::create_and_start(
     ctx, util::get_image_ctx(&image_ctx), io::AIO_TYPE_FLUSH);
-  auto req = io::ImageDispatchSpec<I>::create_flush_request(
+  auto req = io::ImageDispatchSpec<I>::create_flush(
     image_ctx, io::IMAGE_DISPATCH_LAYER_INTERNAL_START, aio_comp,
     io::FLUSH_SOURCE_INTERNAL, {});
   req->send();
index 8bf2c56eb0751be52d7bb6c1c544332228b1fc1d..93f30186406c44bc598496d72ebc17e31a6792e7 100644 (file)
@@ -110,7 +110,7 @@ struct ImageDispatchSpec<librbd::MockRefreshImageCtx> {
   static ImageDispatchSpec* s_instance;
   AioCompletion *aio_comp = nullptr;
 
-  static ImageDispatchSpec* create_flush_request(
+  static ImageDispatchSpec* create_flush(
       librbd::MockRefreshImageCtx &image_ctx, ImageDispatchLayer dispatch_layer,
       AioCompletion *aio_comp, FlushSource flush_source,
       const ZTracer::Trace &parent_trace) {
index b3e24ff50cf0dd29d9d00bdf80db001ddc6d89cd..67b98432bc5e5cdb7928fed43a9815d9c87b3aeb 100644 (file)
@@ -45,7 +45,7 @@ struct ImageDispatchSpec<librbd::MockTestImageCtx> {
 
   std::atomic<uint32_t> image_dispatch_flags = {0};
 
-  static ImageDispatchSpec* create_write_request(
+  static ImageDispatchSpec* create_write(
       librbd::MockTestImageCtx &image_ctx, ImageDispatchLayer dispatch_layer,
       AioCompletion *aio_comp, Extents &&image_extents, bufferlist &&bl,
       int op_flags, const ZTracer::Trace &parent_trace, uint64_t tid) {
@@ -54,7 +54,7 @@ struct ImageDispatchSpec<librbd::MockTestImageCtx> {
     return s_instance;
   }
 
-  static ImageDispatchSpec* create_flush_request(
+  static ImageDispatchSpec* create_flush(
       librbd::MockTestImageCtx &image_ctx, ImageDispatchLayer dispatch_layer,
       AioCompletion *aio_comp, FlushSource flush_source,
       const ZTracer::Trace &parent_trace) {
index 1fa86eea49298b5a7f960766cacb9b07b328c896..e5d1c0beff54e54dc25447d3adc656f030ef155d 100644 (file)
@@ -861,7 +861,7 @@ TEST_F(TestJournalReplay, ObjectPosition) {
   C_SaferCond flush_ctx;
   aio_comp = librbd::io::AioCompletion::create_and_start(
     &flush_ctx, ictx, librbd::io::AIO_TYPE_FLUSH);
-  auto req = librbd::io::ImageDispatchSpec<>::create_flush_request(
+  auto req = librbd::io::ImageDispatchSpec<>::create_flush(
     *ictx, librbd::io::IMAGE_DISPATCH_LAYER_INTERNAL_START, aio_comp,
     librbd::io::FLUSH_SOURCE_INTERNAL, {});
   req->send();
index 96dd70127a4a32131bd3c11e307a563706cdb650..707bdf458135fcc25c6bcdba354e37d0b8a920ea 100644 (file)
@@ -32,7 +32,7 @@ struct ImageDispatchSpec<MockImageCtx> {
   static ImageDispatchSpec* s_instance;
   AioCompletion *aio_comp = nullptr;
 
-  static ImageDispatchSpec* create_flush_request(
+  static ImageDispatchSpec* create_flush(
       MockImageCtx &image_ctx, ImageDispatchLayer dispatch_layer,
       AioCompletion *aio_comp, FlushSource flush_source,
       const ZTracer::Trace &parent_trace) {
index d97804fefedb83e17c5299454be02a744ba73be5..7587760c25fb22a6adbc5021b0d45539625c725f 100644 (file)
@@ -35,7 +35,7 @@ int flush(librbd::ImageCtx *image_ctx) {
   C_SaferCond ctx;
   auto aio_comp = librbd::io::AioCompletion::create_and_start(
     &ctx, image_ctx, librbd::io::AIO_TYPE_FLUSH);
-  auto req = librbd::io::ImageDispatchSpec<>::create_flush_request(
+  auto req = librbd::io::ImageDispatchSpec<>::create_flush(
     *image_ctx, librbd::io::IMAGE_DISPATCH_LAYER_INTERNAL_START, aio_comp,
     librbd::io::FLUSH_SOURCE_INTERNAL, {});
   req->send();