]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: add hooks for rebuild object map to ImageWatcher
authorJason Dillaman <dillaman@redhat.com>
Wed, 18 Mar 2015 14:38:09 +0000 (10:38 -0400)
committerJason Dillaman <dillaman@redhat.com>
Fri, 10 Apr 2015 18:10:04 +0000 (14:10 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/ImageWatcher.cc
src/librbd/ImageWatcher.h

index 218f1a394e467c08e97a89cd273fd095d833d368..4bc8558f4c0a3d6aef74fba24c14f129667020b0 100644 (file)
@@ -480,6 +480,19 @@ int ImageWatcher::notify_snap_create(const std::string &snap_name) {
   return notify_lock_owner(bl);
 }
 
+int ImageWatcher::notify_rebuild_object_map(uint64_t request_id,
+                                            ProgressContext &prog_ctx) {
+  assert(m_image_ctx.owner_lock.is_locked());
+  assert(!is_lock_owner());
+
+  AsyncRequestId async_request_id(get_client_id(), request_id);
+
+  bufferlist bl;
+  ::encode(NotifyMessage(RebuildObjectMapPayload(async_request_id)), bl);
+
+  return notify_async_request(async_request_id, bl, prog_ctx);
+}
+
 void ImageWatcher::notify_header_update(librados::IoCtx &io_ctx,
                                        const std::string &oid)
 {
@@ -894,6 +907,16 @@ void ImageWatcher::handle_payload(const SnapCreatePayload &payload,
   }
 }
 
+void ImageWatcher::handle_payload(const RebuildObjectMapPayload& payload,
+                                  bufferlist *out) {
+  RWLock::RLocker l(m_image_ctx.owner_lock);
+  if (m_lock_owner_state == LOCK_OWNER_STATE_LOCKED) {
+    ldout(m_image_ctx.cct, 10) << "remote rebuild_object_map request" << dendl;
+
+    // TODO
+    ::encode(ResponseMessage(0), *out);
+  }
+}
 void ImageWatcher::handle_payload(const UnknownPayload &payload,
                                  bufferlist *out) {
   RWLock::RLocker l(m_image_ctx.owner_lock);
index d75e2fe22223fa8f26b919baf1ae1d07b3413afb..7da9f07191b1a39a65e2ecac99db4793aa7e57f0 100644 (file)
@@ -49,6 +49,8 @@ namespace librbd {
     int notify_resize(uint64_t request_id, uint64_t size,
                      ProgressContext &prog_ctx);
     int notify_snap_create(const std::string &snap_name);
+    int notify_rebuild_object_map(uint64_t request_id,
+                                  ProgressContext &prog_ctx);
 
     static void notify_header_update(librados::IoCtx &io_ctx,
                                     const std::string &oid);
@@ -257,6 +259,8 @@ namespace librbd {
                        bufferlist *out);
     void handle_payload(const WatchNotify::SnapCreatePayload& payload,
                        bufferlist *out);
+    void handle_payload(const WatchNotify::RebuildObjectMapPayload& payload,
+                        bufferlist *out);
     void handle_payload(const WatchNotify::UnknownPayload& payload,
                        bufferlist *out);