From: Jason Dillaman Date: Tue, 20 Oct 2020 15:13:11 +0000 (-0400) Subject: librbd: remove remainder of ImageCache API hooks X-Git-Tag: v17.0.0~837^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=f53c3eef2bd7c217733c674a087929514ab28975;p=ceph-ci.git librbd: remove remainder of ImageCache API hooks 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 --- diff --git a/src/librbd/CMakeLists.txt b/src/librbd/CMakeLists.txt index 62137fb52aa..291b95d39ad 100644 --- a/src/librbd/CMakeLists.txt +++ b/src/librbd/CMakeLists.txt @@ -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 index 896c4363021..00000000000 --- a/src/librbd/cache/ImageCache.h +++ /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 - -class Context; - -namespace librbd { -struct ImageCtx; -namespace cache { - -/** - * client-side, image extent cache interface - */ -template -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; - -#endif // CEPH_LIBRBD_CACHE_IMAGE_CACHE diff --git a/src/librbd/cache/PassthroughImageCache.cc b/src/librbd/cache/PassthroughImageCache.cc deleted file mode 100644 index 44d2cdb360d..00000000000 --- a/src/librbd/cache/PassthroughImageCache.cc +++ /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 -PassthroughImageCache::PassthroughImageCache(ImageCtx &image_ctx) - : m_image_ctx(image_ctx), m_image_writeback(image_ctx) { -} - -template -void PassthroughImageCache::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 -void PassthroughImageCache::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 -void PassthroughImageCache::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 -void PassthroughImageCache::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 -void PassthroughImageCache::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 -void PassthroughImageCache::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 -void PassthroughImageCache::init(Context *on_finish) { - CephContext *cct = m_image_ctx.cct; - ldout(cct, 20) << dendl; - - on_finish->complete(0); -} - -template -void PassthroughImageCache::shut_down(Context *on_finish) { - CephContext *cct = m_image_ctx.cct; - ldout(cct, 20) << dendl; - - on_finish->complete(0); -} - -template -void PassthroughImageCache::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 -void PassthroughImageCache::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; diff --git a/src/librbd/cache/PassthroughImageCache.h b/src/librbd/cache/PassthroughImageCache.h deleted file mode 100644 index 1101422899e..00000000000 --- a/src/librbd/cache/PassthroughImageCache.h +++ /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 -class PassthroughImageCache : public ImageCache { -public: - using typename ImageCache::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 m_image_writeback; - -}; - -} // namespace cache -} // namespace librbd - -extern template class librbd::cache::PassthroughImageCache; - -#endif // CEPH_LIBRBD_CACHE_PASSTHROUGH_IMAGE_CACHE diff --git a/src/librbd/cache/pwl/ReplicatedWriteLog.h b/src/librbd/cache/pwl/ReplicatedWriteLog.h index 27d34f6e158..995c8bf96b6 100644 --- a/src/librbd/cache/pwl/ReplicatedWriteLog.h +++ b/src/librbd/cache/pwl/ReplicatedWriteLog.h @@ -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" diff --git a/src/librbd/cache/pwl/Request.h b/src/librbd/cache/pwl/Request.h index fd6fa71b9e2..53a013d46d4 100644 --- a/src/librbd/cache/pwl/Request.h +++ b/src/librbd/cache/pwl/Request.h @@ -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" diff --git a/src/librbd/cache/pwl/Types.cc b/src/librbd/cache/pwl/Types.cc index d19ad0ed406..31bd0af00ad 100644 --- a/src/librbd/cache/pwl/Types.cc +++ b/src/librbd/cache/pwl/Types.cc @@ -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.