]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: remove remainder of ImageCache API hooks 37726/head
authorJason Dillaman <dillaman@redhat.com>
Tue, 20 Oct 2020 15:13:11 +0000 (11:13 -0400)
committerJason Dillaman <dillaman@redhat.com>
Tue, 20 Oct 2020 15:13:11 +0000 (11:13 -0400)
With the incorporation of the ImageDispatcher, there is no longer a
need for the ImageCache (and related) classes which were added as
a temporary workaround to incorporate the PWL cache.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/CMakeLists.txt
src/librbd/cache/ImageCache.h [deleted file]
src/librbd/cache/PassthroughImageCache.cc [deleted file]
src/librbd/cache/PassthroughImageCache.h [deleted file]
src/librbd/cache/pwl/ReplicatedWriteLog.h
src/librbd/cache/pwl/Request.h
src/librbd/cache/pwl/Types.cc

index 62137fb52aa63130376aecb4fad555d1235b6d2f..291b95d39ad6ff7f12d47c2ce2b7e527d8d98638 100644 (file)
@@ -42,7 +42,6 @@ set(librbd_internal_srcs
   cache/ImageWriteback.cc
   cache/ObjectCacherObjectDispatch.cc
   cache/ObjectCacherWriteback.cc
-  cache/PassthroughImageCache.cc
   cache/pwl/InitRequest.cc
   cache/pwl/ShutdownRequest.cc
   cache/WriteAroundObjectDispatch.cc
diff --git a/src/librbd/cache/ImageCache.h b/src/librbd/cache/ImageCache.h
deleted file mode 100644 (file)
index 896c436..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-// vim: ts=8 sw=2 smarttab
-
-#ifndef CEPH_LIBRBD_CACHE_IMAGE_CACHE
-#define CEPH_LIBRBD_CACHE_IMAGE_CACHE
-
-#include "include/buffer_fwd.h"
-#include "include/int_types.h"
-#include "librbd/io/Types.h"
-#include <vector>
-
-class Context;
-
-namespace librbd {
-struct ImageCtx;
-namespace cache {
-
-/**
- * client-side, image extent cache interface
- */
-template <typename ImageCtxT = ImageCtx>
-struct ImageCache {
-protected:
-  ImageCache() {}
-public:
-  typedef io::Extent Extent;
-  typedef io::Extents Extents;
-
-  virtual ~ImageCache() {}
-
-  /// client AIO methods
-  virtual void aio_read(Extents&& image_extents, ceph::bufferlist* bl,
-                        int fadvise_flags, Context *on_finish) = 0;
-  virtual void aio_write(Extents&& image_extents, ceph::bufferlist&& bl,
-                         int fadvise_flags, Context *on_finish) = 0;
-  virtual void aio_discard(uint64_t offset, uint64_t length,
-                           uint32_t discard_granularity_bytes,
-                           Context *on_finish) = 0;
-  virtual void aio_flush(io::FlushSource flush_source, Context *on_finish) = 0;
-  virtual void aio_writesame(uint64_t offset, uint64_t length,
-                             ceph::bufferlist&& bl,
-                             int fadvise_flags, Context *on_finish) = 0;
-  virtual void aio_compare_and_write(Extents&& image_extents,
-                                     ceph::bufferlist&& cmp_bl,
-                                     ceph::bufferlist&& bl,
-                                     uint64_t *mismatch_offset,
-                                     int fadvise_flags,
-                                     Context *on_finish) = 0;
-
-  /// internal state methods
-  virtual void init(Context *on_finish) = 0;
-  virtual void shut_down(Context *on_finish) = 0;
-
-  virtual void invalidate(Context *on_finish) = 0;
-  virtual void flush(Context *on_finish) = 0;
-};
-
-} // namespace cache
-} // namespace librbd
-
-extern template class librbd::cache::ImageCache<librbd::ImageCtx>;
-
-#endif // CEPH_LIBRBD_CACHE_IMAGE_CACHE
diff --git a/src/librbd/cache/PassthroughImageCache.cc b/src/librbd/cache/PassthroughImageCache.cc
deleted file mode 100644 (file)
index 44d2cdb..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-// vim: ts=8 sw=2 smarttab
-
-#include "PassthroughImageCache.h"
-#include "include/buffer.h"
-#include "common/dout.h"
-#include "librbd/ImageCtx.h"
-
-#define dout_subsys ceph_subsys_rbd
-#undef dout_prefix
-#define dout_prefix *_dout << "librbd::PassthroughImageCache: " << this << " " \
-                           <<  __func__ << ": "
-
-namespace librbd {
-namespace cache {
-
-template <typename I>
-PassthroughImageCache<I>::PassthroughImageCache(ImageCtx &image_ctx)
-  : m_image_ctx(image_ctx), m_image_writeback(image_ctx) {
-}
-
-template <typename I>
-void PassthroughImageCache<I>::aio_read(Extents &&image_extents, bufferlist *bl,
-                                        int fadvise_flags, Context *on_finish) {
-  CephContext *cct = m_image_ctx.cct;
-  ldout(cct, 20) << "image_extents=" << image_extents << ", "
-                 << "on_finish=" << on_finish << dendl;
-
-  m_image_writeback.aio_read(std::move(image_extents), bl, fadvise_flags,
-                             on_finish);
-}
-
-template <typename I>
-void PassthroughImageCache<I>::aio_write(Extents &&image_extents,
-                                         bufferlist&& bl,
-                                         int fadvise_flags,
-                                         Context *on_finish) {
-  CephContext *cct = m_image_ctx.cct;
-  ldout(cct, 20) << "image_extents=" << image_extents << ", "
-                 << "on_finish=" << on_finish << dendl;
-
-  m_image_writeback.aio_write(std::move(image_extents), std::move(bl),
-                              fadvise_flags, on_finish);
-}
-
-template <typename I>
-void PassthroughImageCache<I>::aio_discard(uint64_t offset, uint64_t length,
-                                           uint32_t discard_granularity_bytes,
-                                           Context *on_finish) {
-  CephContext *cct = m_image_ctx.cct;
-  ldout(cct, 20) << "offset=" << offset << ", "
-                 << "length=" << length << ", "
-                 << "on_finish=" << on_finish << dendl;
-
-  m_image_writeback.aio_discard(offset, length, discard_granularity_bytes,
-                                on_finish);
-}
-
-template <typename I>
-void PassthroughImageCache<I>::aio_flush(librbd::io::FlushSource flush_source, Context *on_finish) {
-  CephContext *cct = m_image_ctx.cct;
-  ldout(cct, 20) << "on_finish=" << on_finish << dendl;
-
-  m_image_writeback.aio_flush(flush_source, on_finish);
-}
-
-template <typename I>
-void PassthroughImageCache<I>::aio_writesame(uint64_t offset, uint64_t length,
-                                             bufferlist&& bl, int fadvise_flags,
-                                             Context *on_finish) {
-  CephContext *cct = m_image_ctx.cct;
-  ldout(cct, 20) << "offset=" << offset << ", "
-                 << "length=" << length << ", "
-                 << "data_len=" << bl.length() << ", "
-                 << "on_finish=" << on_finish << dendl;
-
-  m_image_writeback.aio_writesame(offset, length, std::move(bl), fadvise_flags,
-                                  on_finish);
-}
-
-template <typename I>
-void PassthroughImageCache<I>::aio_compare_and_write(Extents &&image_extents,
-                                                     bufferlist&& cmp_bl,
-                                                     bufferlist&& bl,
-                                                     uint64_t *mismatch_offset,
-                                                     int fadvise_flags,
-                                                     Context *on_finish) {
-  CephContext *cct = m_image_ctx.cct;
-  ldout(cct, 20) << "image_extents=" << image_extents << ", "
-                 << "on_finish=" << on_finish << dendl;
-
-  m_image_writeback.aio_compare_and_write(
-    std::move(image_extents), std::move(cmp_bl), std::move(bl), mismatch_offset,
-    fadvise_flags, on_finish);
-}
-
-template <typename I>
-void PassthroughImageCache<I>::init(Context *on_finish) {
-  CephContext *cct = m_image_ctx.cct;
-  ldout(cct, 20) << dendl;
-
-  on_finish->complete(0);
-}
-
-template <typename I>
-void PassthroughImageCache<I>::shut_down(Context *on_finish) {
-  CephContext *cct = m_image_ctx.cct;
-  ldout(cct, 20) << dendl;
-
-  on_finish->complete(0);
-}
-
-template <typename I>
-void PassthroughImageCache<I>::invalidate(Context *on_finish) {
-  CephContext *cct = m_image_ctx.cct;
-  ldout(cct, 20) << dendl;
-
-  // dump cache contents (don't have anything)
-  on_finish->complete(0);
-}
-
-template <typename I>
-void PassthroughImageCache<I>::flush(Context *on_finish) {
-  CephContext *cct = m_image_ctx.cct;
-  ldout(cct, 20) << dendl;
-
-  // internal flush -- nothing to writeback but make sure
-  // in-flight IO is flushed
-  aio_flush(librbd::io::FLUSH_SOURCE_INTERNAL, on_finish);
-}
-
-} // namespace cache
-} // namespace librbd
-
-template class librbd::cache::PassthroughImageCache<librbd::ImageCtx>;
diff --git a/src/librbd/cache/PassthroughImageCache.h b/src/librbd/cache/PassthroughImageCache.h
deleted file mode 100644 (file)
index 1101422..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-// vim: ts=8 sw=2 smarttab
-
-#ifndef CEPH_LIBRBD_CACHE_PASSTHROUGH_IMAGE_CACHE
-#define CEPH_LIBRBD_CACHE_PASSTHROUGH_IMAGE_CACHE
-
-#include "ImageCache.h"
-#include "ImageWriteback.h"
-
-namespace librbd {
-
-struct ImageCtx;
-
-namespace cache {
-
-/**
- * Example passthrough client-side, image extent cache
- */
-template <typename ImageCtxT = librbd::ImageCtx>
-class PassthroughImageCache : public ImageCache<ImageCtxT> {
-public:
-  using typename ImageCache<ImageCtxT>::Extents;
-  explicit PassthroughImageCache(ImageCtx &image_ctx);
-
-  /// client AIO methods
-  void aio_read(Extents&& image_extents, ceph::bufferlist *bl,
-                int fadvise_flags, Context *on_finish) override;
-  void aio_write(Extents&& image_extents, ceph::bufferlist&& bl,
-                 int fadvise_flags, Context *on_finish) override;
-  void aio_discard(uint64_t offset, uint64_t length,
-                   uint32_t discard_granularity_bytes,
-                   Context *on_finish) override;
-  void aio_flush(librbd::io::FlushSource flush_source, Context *on_finish) override;
-  void aio_writesame(uint64_t offset, uint64_t length,
-                     ceph::bufferlist&& bl,
-                     int fadvise_flags, Context *on_finish) override;
-  void aio_compare_and_write(Extents&& image_extents,
-                             ceph::bufferlist&& cmp_bl, ceph::bufferlist&& bl,
-                             uint64_t *mismatch_offset,int fadvise_flags,
-                             Context *on_finish) override;
-
-  /// internal state methods
-  void init(Context *on_finish) override;
-  void shut_down(Context *on_finish) override;
-
-  void invalidate(Context *on_finish) override;
-  void flush(Context *on_finish) override;
-
-private:
-  ImageCtxT &m_image_ctx;
-  ImageWriteback<ImageCtxT> m_image_writeback;
-
-};
-
-} // namespace cache
-} // namespace librbd
-
-extern template class librbd::cache::PassthroughImageCache<librbd::ImageCtx>;
-
-#endif // CEPH_LIBRBD_CACHE_PASSTHROUGH_IMAGE_CACHE
index 27d34f6e1581d9ae28aac6fdc79f6b361b9601d9..995c8bf96b62cf0efe31634ba43aeeb12c1a2515 100644 (file)
@@ -7,7 +7,6 @@
 #include "common/RWLock.h"
 #include "common/WorkQueue.h"
 #include "common/AsyncOpTracker.h"
-#include "librbd/cache/ImageCache.h"
 #include "librbd/cache/ImageWriteback.h"
 #include "librbd/Utils.h"
 #include "librbd/BlockGuard.h"
index fd6fa71b9e23504a92c7f97c632491d6b3abdcc6..53a013d46d4b0740d1733634f5c203ac4e405c5f 100644 (file)
@@ -5,7 +5,6 @@
 #define CEPH_LIBRBD_CACHE_RWL_REQUEST_H 
 
 #include "include/Context.h"
-#include "librbd/cache/ImageCache.h"
 #include "librbd/cache/pwl/Types.h"
 #include "librbd/cache/pwl/LogOperation.h"
 
index d19ad0ed406d70e408f7725763f3902c51fb6d74..31bd0af00ad36ad54ca77cdea1698fee0f35e291 100644 (file)
@@ -30,7 +30,7 @@ void DeferredContexts::add(Context* ctx) {
  *
  * An Extent ("image extent") identifies a range by start and length.
  *
- * The ImageCache interface is defined in terms of image extents, and
+ * The ImageDispatch interface is defined in terms of image extents, and
  * requires no alignment of the beginning or end of the extent. We
  * convert between image and block extents here using a "block size"
  * of 1.