From: Jason Dillaman Date: Tue, 8 Dec 2015 21:25:54 +0000 (-0500) Subject: librbd: rename ImageRefresh to ImageState X-Git-Tag: v10.0.2~35^2~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3fd24eb2cdb7594ef819b767db9998480cbf1ef8;p=ceph.git librbd: rename ImageRefresh to ImageState This class handles more than just refreshing the image from disk. Signed-off-by: Jason Dillaman --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e5ada3be176e..41c6eec3a6c4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -880,7 +880,7 @@ if(${WITH_RBD}) librbd/DiffIterate.cc librbd/ExclusiveLock.cc librbd/ImageCtx.cc - librbd/ImageRefresh.cc + librbd/ImageState.cc librbd/ImageWatcher.cc librbd/internal.cc librbd/Journal.cc diff --git a/src/librbd/ImageRefresh.cc b/src/librbd/ImageRefresh.cc deleted file mode 100644 index 224b1277c7c8..000000000000 --- a/src/librbd/ImageRefresh.cc +++ /dev/null @@ -1,35 +0,0 @@ -// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- -// vim: ts=8 sw=2 smarttab - -#include "librbd/ImageRefresh.h" -#include "common/dout.h" -#include "common/errno.h" -#include "librbd/image/RefreshRequest.h" - -#define dout_subsys ceph_subsys_rbd -#undef dout_prefix -#define dout_prefix *_dout << "librbd::ImageRefresh: " - -namespace librbd { - -template -ImageRefresh::ImageRefresh(I &image_ctx) : m_image_ctx(image_ctx) { -} - -template -bool ImageRefresh::is_refresh_required() const { - // TODO future entry point for AIO ops -- to replace ictx_check call - return false; -} - -template -void ImageRefresh::refresh(Context *on_finish) { - // TODO simple state machine to restrict to a single in-progress refresh / snap set - image::RefreshRequest *req = image::RefreshRequest::create( - m_image_ctx, on_finish); - req->send(); -} - -} // namespace librbd - -template class librbd::ImageRefresh; diff --git a/src/librbd/ImageRefresh.h b/src/librbd/ImageRefresh.h deleted file mode 100644 index 4612f96658c1..000000000000 --- a/src/librbd/ImageRefresh.h +++ /dev/null @@ -1,33 +0,0 @@ -// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- -// vim: ts=8 sw=2 smarttab - -#ifndef CEPH_LIBRBD_IMAGE_REFRESH_H -#define CEPH_LIBRBD_IMAGE_REFRESH_H - -#include "include/int_types.h" - -class Context; - -namespace librbd { - -class ImageCtx; - -template -class ImageRefresh { -public: - ImageRefresh(ImageCtxT &image_ctx); - - bool is_refresh_required() const; - - void refresh(Context *on_finish); - -private: - ImageCtxT &m_image_ctx; - -}; - -} // namespace librbd - -extern template class librbd::ImageRefresh; - -#endif // CEPH_LIBRBD_IMAGE_REFRESH_H diff --git a/src/librbd/ImageState.cc b/src/librbd/ImageState.cc new file mode 100644 index 000000000000..f2ac1219260a --- /dev/null +++ b/src/librbd/ImageState.cc @@ -0,0 +1,35 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#include "librbd/ImageState.h" +#include "common/dout.h" +#include "common/errno.h" +#include "librbd/image/StateRequest.h" + +#define dout_subsys ceph_subsys_rbd +#undef dout_prefix +#define dout_prefix *_dout << "librbd::ImageState: " + +namespace librbd { + +template +ImageState::ImageState(I &image_ctx) : m_image_ctx(image_ctx) { +} + +template +bool ImageState::is_refresh_required() const { + // TODO future entry point for AIO ops -- to replace ictx_check call + return false; +} + +template +void ImageState::refresh(Context *on_finish) { + // TODO simple state machine to restrict to a single in-progress refresh / snap set + image::StateRequest *req = image::StateRequest::create( + m_image_ctx, on_finish); + req->send(); +} + +} // namespace librbd + +template class librbd::ImageState; diff --git a/src/librbd/ImageState.h b/src/librbd/ImageState.h new file mode 100644 index 000000000000..b323be77a503 --- /dev/null +++ b/src/librbd/ImageState.h @@ -0,0 +1,33 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#ifndef CEPH_LIBRBD_IMAGE_STATE_H +#define CEPH_LIBRBD_IMAGE_STATE_H + +#include "include/int_types.h" + +class Context; + +namespace librbd { + +class ImageCtx; + +template +class ImageState { +public: + ImageState(ImageCtxT &image_ctx); + + bool is_refresh_required() const; + + void refresh(Context *on_finish); + +private: + ImageCtxT &m_image_ctx; + +}; + +} // namespace librbd + +extern template class librbd::ImageState; + +#endif // CEPH_LIBRBD_IMAGE_STATE_H diff --git a/src/librbd/Makefile.am b/src/librbd/Makefile.am index f5be6da63ca1..153b69e4c817 100644 --- a/src/librbd/Makefile.am +++ b/src/librbd/Makefile.am @@ -19,7 +19,7 @@ librbd_internal_la_SOURCES = \ librbd/DiffIterate.cc \ librbd/ExclusiveLock.cc \ librbd/ImageCtx.cc \ - librbd/ImageRefresh.cc \ + librbd/ImageState.cc \ librbd/ImageWatcher.cc \ librbd/internal.cc \ librbd/Journal.cc \ @@ -93,7 +93,7 @@ noinst_HEADERS += \ librbd/DiffIterate.h \ librbd/ExclusiveLock.h \ librbd/ImageCtx.h \ - librbd/ImageRefresh.h \ + librbd/ImageState.h \ librbd/ImageWatcher.h \ librbd/internal.h \ librbd/Journal.h \