or use any other convenient way to restore the schedule after the
upgrade.
+
+
+>=16.0.0
+---------
+
+* librbd: The shared, read-only parent cache has been moved to a separate librbd
+ plugin. If the parent cache was previously in-use, you must also instruct
+ librbd to load the plugin by adding the following to your configuration::
+
+ rbd_plugins = parent_cache
----------------------------------------------
To enable RBD shared read-only parent image cache, the following Ceph settings
-need to added in the ``[client]`` `section`_ of your ``ceph.conf`` file.
-
-``rbd parent cache enabled = true``
+need to added in the ``[client]`` `section`_ of your ``ceph.conf`` file::
+ rbd parent cache enabled = true
+ rbd plugins = parent_cache
Immutable Object Cache Daemon
=============================
api/Trash.cc
cache/ImageWriteback.cc
cache/ObjectCacherObjectDispatch.cc
- cache/ParentCacheObjectDispatch.cc
cache/ObjectCacherWriteback.cc
cache/PassthroughImageCache.cc
cache/WriteAroundObjectDispatch.cc
add_custom_target(librbd_plugins)
set(librbd_plugins_dir ${CEPH_INSTALL_PKGLIBDIR}/librbd)
+set(rbd_plugin_parent_cache_srcs
+ cache/ParentCacheObjectDispatch.cc
+ plugin/ParentCache.cc)
+add_library(librbd_plugin_parent_cache SHARED ${rbd_plugin_parent_cache_srcs})
+target_link_libraries(librbd_plugin_parent_cache PRIVATE
+ ceph_immutable_object_cache_lib)
+set_target_properties(librbd_plugin_parent_cache PROPERTIES
+ OUTPUT_NAME ceph_librbd_parent_cache
+ VERSION 1.0.0
+ SOVERSION 1)
+install(TARGETS librbd_plugin_parent_cache DESTINATION ${librbd_plugins_dir})
+add_dependencies(librbd_plugins librbd_plugin_parent_cache)
+
if(WITH_EVENTTRACE)
list(APPEND librbd_internal_srcs ../common/EventTrace.cc)
endif()
add_dependencies(rbd_internal eventtrace_tp)
endif()
target_link_libraries(rbd_internal PRIVATE
- ceph_immutable_object_cache_lib
osdc)
if(WITH_RBD_RWL)
#include "librbd/Utils.h"
#include "librbd/cache/ObjectCacherObjectDispatch.h"
#include "librbd/cache/WriteAroundObjectDispatch.h"
-#include "librbd/cache/ParentCacheObjectDispatch.cc"
#include "librbd/image/CloseRequest.h"
#include "librbd/image/RefreshRequest.h"
#include "librbd/image/SetSnapRequest.h"
return nullptr;
}
- return send_parent_cache(result);
-}
-
-template <typename I>
-Context* OpenRequest<I>::send_parent_cache(int *result) {
- CephContext *cct = m_image_ctx->cct;
- ldout(cct, 10) << __func__ << ": r=" << *result << dendl;
-
- bool parent_cache_enabled = m_image_ctx->config.template get_val<bool>(
- "rbd_parent_cache_enabled");
-
- if (m_image_ctx->child == nullptr || !parent_cache_enabled) {
- return send_init_cache(result);
- }
-
- auto parent_cache = cache::ParentCacheObjectDispatch<I>::create(m_image_ctx);
- using klass = OpenRequest<I>;
- Context *ctx = create_context_callback<
- klass, &klass::handle_parent_cache>(this);
-
- parent_cache->init(ctx);
- return nullptr;
-}
-
-template <typename I>
-Context* OpenRequest<I>::handle_parent_cache(int* result) {
- CephContext *cct = m_image_ctx->cct;
- ldout(cct, 10) << __func__ << ": r=" << *result << dendl;
-
- if (*result < 0) {
- lderr(cct) << "failed to parent cache " << dendl;
- send_close_image(*result);
- return nullptr;
- }
-
return send_init_cache(result);
}
* INIT_PLUGIN_REGISTRY
* |
* v
- * INIT_PARENT_CACHE(skip if
- * | disable)
- * v
* INIT_CACHE
* |
* v
void send_init_plugin_registry();
Context* handle_init_plugin_registry(int *result);
- Context* send_parent_cache(int *result);
- Context* handle_parent_cache(int *result);
-
Context *send_init_cache(int *result);
Context *send_register_watch(int *result);
--- /dev/null
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#include "librbd/plugin/ParentCache.h"
+#include "ceph_ver.h"
+#include "common/dout.h"
+#include "common/errno.h"
+#include "common/PluginRegistry.h"
+#include "librbd/ImageCtx.h"
+#include "librbd/cache/ParentCacheObjectDispatch.h"
+
+extern "C" {
+
+const char *__ceph_plugin_version() {
+ return CEPH_GIT_NICE_VER;
+}
+
+int __ceph_plugin_init(CephContext *cct, const std::string& type,
+ const std::string& name) {
+ auto plugin_registry = cct->get_plugin_registry();
+ return plugin_registry->add(
+ type, name, new librbd::plugin::ParentCache<librbd::ImageCtx>(cct));
+}
+
+} // extern "C"
+
+#define dout_subsys ceph_subsys_rbd
+#undef dout_prefix
+#define dout_prefix *_dout << "librbd::plugin::ParentCache: " \
+ << this << " " << __func__ << ": "
+
+namespace librbd {
+namespace plugin {
+
+template <typename I>
+void ParentCache<I>::init(I* image_ctx, HookPoints* hook_points,
+ Context* on_finish) {
+ m_image_ctx = image_ctx;
+ bool parent_cache_enabled = m_image_ctx->config.template get_val<bool>(
+ "rbd_parent_cache_enabled");
+ if (m_image_ctx->child == nullptr || !parent_cache_enabled) {
+ on_finish->complete(0);
+ return;
+ }
+
+ auto cct = m_image_ctx->cct;
+ ldout(cct, 5) << dendl;
+
+ auto parent_cache = cache::ParentCacheObjectDispatch<I>::create(m_image_ctx);
+ on_finish = new LambdaContext([this, on_finish, parent_cache](int r) {
+ if (r < 0) {
+ // the object dispatcher will handle cleanup if successfully initialized
+ delete parent_cache;
+ }
+
+ handle_init_parent_cache(r, on_finish);
+ });
+ parent_cache->init(on_finish);
+}
+
+template <typename I>
+void ParentCache<I>::handle_init_parent_cache(int r, Context* on_finish) {
+ auto cct = m_image_ctx->cct;
+ ldout(cct, 5) << "r=" << r << dendl;
+
+ if (r < 0) {
+ lderr(cct) << "Failed to initialize parent cache object dispatch layer: "
+ << cpp_strerror(r) << dendl;
+ on_finish->complete(r);
+ return;
+ }
+
+ on_finish->complete(0);
+}
+
+} // namespace plugin
+} // namespace librbd
+
+template class librbd::plugin::ParentCache<librbd::ImageCtx>;
--- /dev/null
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#ifndef CEPH_LIBRBD_PLUGIN_PARENT_CACHE_H
+#define CEPH_LIBRBD_PLUGIN_PARENT_CACHE_H
+
+#include "librbd/plugin/Types.h"
+#include "include/Context.h"
+
+namespace librbd {
+
+struct ImageCtx;
+
+namespace plugin {
+
+template <typename ImageCtxT>
+class ParentCache : public Interface<ImageCtxT> {
+public:
+ ParentCache(CephContext* cct) : Interface<ImageCtxT>(cct) {
+ }
+
+ void init(ImageCtxT* image_ctx, HookPoints* hook_points,
+ Context* on_finish) override;
+
+private:
+ ImageCtxT* m_image_ctx = nullptr;
+
+ void handle_init_parent_cache(int r, Context* on_finish);
+
+};
+
+} // namespace plugin
+} // namespace librbd
+
+extern template class librbd::plugin::ParentCache<librbd::ImageCtx>;
+
+#endif // CEPH_LIBRBD_PLUGIN_PARENT_CACHE_H
rbd_api
rbd_internal
rbd_types
+ ceph_immutable_object_cache_lib
osdc
ceph-common
global