]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: rename ImageRefresh to ImageState
authorJason Dillaman <dillaman@redhat.com>
Tue, 8 Dec 2015 21:25:54 +0000 (16:25 -0500)
committerJason Dillaman <dillaman@redhat.com>
Tue, 15 Dec 2015 01:31:31 +0000 (20:31 -0500)
This class handles more than just refreshing the image from
disk.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/CMakeLists.txt
src/librbd/ImageRefresh.cc [deleted file]
src/librbd/ImageRefresh.h [deleted file]
src/librbd/ImageState.cc [new file with mode: 0644]
src/librbd/ImageState.h [new file with mode: 0644]
src/librbd/Makefile.am

index e5ada3be176e5ee6e3d0f0fa10ca02078a032f77..41c6eec3a6c4771b8d33e3df0db117226b12ff00 100644 (file)
@@ -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 (file)
index 224b127..0000000
+++ /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 <typename I>
-ImageRefresh<I>::ImageRefresh(I &image_ctx) : m_image_ctx(image_ctx) {
-}
-
-template <typename I>
-bool ImageRefresh<I>::is_refresh_required() const {
-  // TODO future entry point for AIO ops -- to replace ictx_check call
-  return false;
-}
-
-template <typename I>
-void ImageRefresh<I>::refresh(Context *on_finish) {
-  // TODO simple state machine to restrict to a single in-progress refresh / snap set
-  image::RefreshRequest<I> *req = image::RefreshRequest<I>::create(
-    m_image_ctx, on_finish);
-  req->send();
-}
-
-} // namespace librbd
-
-template class librbd::ImageRefresh<librbd::ImageCtx>;
diff --git a/src/librbd/ImageRefresh.h b/src/librbd/ImageRefresh.h
deleted file mode 100644 (file)
index 4612f96..0000000
+++ /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 <typename ImageCtxT = ImageCtx>
-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<librbd::ImageCtx>;
-
-#endif // CEPH_LIBRBD_IMAGE_REFRESH_H
diff --git a/src/librbd/ImageState.cc b/src/librbd/ImageState.cc
new file mode 100644 (file)
index 0000000..f2ac121
--- /dev/null
@@ -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 <typename I>
+ImageState<I>::ImageState(I &image_ctx) : m_image_ctx(image_ctx) {
+}
+
+template <typename I>
+bool ImageState<I>::is_refresh_required() const {
+  // TODO future entry point for AIO ops -- to replace ictx_check call
+  return false;
+}
+
+template <typename I>
+void ImageState<I>::refresh(Context *on_finish) {
+  // TODO simple state machine to restrict to a single in-progress refresh / snap set
+  image::StateRequest<I> *req = image::StateRequest<I>::create(
+    m_image_ctx, on_finish);
+  req->send();
+}
+
+} // namespace librbd
+
+template class librbd::ImageState<librbd::ImageCtx>;
diff --git a/src/librbd/ImageState.h b/src/librbd/ImageState.h
new file mode 100644 (file)
index 0000000..b323be7
--- /dev/null
@@ -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 <typename ImageCtxT = ImageCtx>
+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<librbd::ImageCtx>;
+
+#endif // CEPH_LIBRBD_IMAGE_STATE_H
index f5be6da63ca1fc60bcbaff94e3ec84cdafe8ad50..153b69e4c81785013b68a4a17c05478f197cb6d0 100644 (file)
@@ -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 \