From: Jason Dillaman Date: Wed, 18 Mar 2015 14:38:09 +0000 (-0400) Subject: librbd: add hooks for rebuild object map to ImageWatcher X-Git-Tag: v9.0.1~149^2~21 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1479161b74cc98eacfef09467c6d06bca640ae86;p=ceph.git librbd: add hooks for rebuild object map to ImageWatcher Signed-off-by: Jason Dillaman --- diff --git a/src/librbd/ImageWatcher.cc b/src/librbd/ImageWatcher.cc index 218f1a394e46..4bc8558f4c0a 100644 --- a/src/librbd/ImageWatcher.cc +++ b/src/librbd/ImageWatcher.cc @@ -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); diff --git a/src/librbd/ImageWatcher.h b/src/librbd/ImageWatcher.h index d75e2fe22223..7da9f07191b1 100644 --- a/src/librbd/ImageWatcher.h +++ b/src/librbd/ImageWatcher.h @@ -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);