From cc3890eea805f2d2c7cba291e8c09b5cfa7b7804 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Thu, 19 Mar 2015 21:19:22 -0400 Subject: [PATCH] librbd: add rebuild_object_map to public API Signed-off-by: Jason Dillaman --- src/include/rbd/librbd.h | 4 ++++ src/include/rbd/librbd.hpp | 3 +++ src/librbd/librbd.cc | 14 ++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/src/include/rbd/librbd.h b/src/include/rbd/librbd.h index 9e54b318a07..6a755b5d6b3 100644 --- a/src/include/rbd/librbd.h +++ b/src/include/rbd/librbd.h @@ -164,6 +164,10 @@ CEPH_RBD_API int rbd_get_flags(rbd_image_t image, uint64_t *flags); /* exclusive lock feature */ CEPH_RBD_API int rbd_is_exclusive_lock_owner(rbd_image_t image, int *is_owner); +/* object map feature */ +CEPH_RBD_API int rbd_rebuild_object_map(rbd_image_t image, + librbd_progress_fn_t cb, void *cbdata); + CEPH_RBD_API int rbd_copy(rbd_image_t image, rados_ioctx_t dest_io_ctx, const char *destname); CEPH_RBD_API int rbd_copy2(rbd_image_t src, rbd_image_t dest); diff --git a/src/include/rbd/librbd.hpp b/src/include/rbd/librbd.hpp index 52c713b58bc..ea81b8fed51 100644 --- a/src/include/rbd/librbd.hpp +++ b/src/include/rbd/librbd.hpp @@ -123,6 +123,9 @@ public: /* exclusive lock feature */ int is_exclusive_lock_owner(bool *is_owner); + /* object map feature */ + int rebuild_object_map(ProgressContext &prog_ctx); + int copy(IoCtx& dest_io_ctx, const char *destname); int copy2(Image& dest); int copy_with_progress(IoCtx& dest_io_ctx, const char *destname, diff --git a/src/librbd/librbd.cc b/src/librbd/librbd.cc index 60abe6a0d23..5a2518e8585 100644 --- a/src/librbd/librbd.cc +++ b/src/librbd/librbd.cc @@ -387,6 +387,12 @@ namespace librbd { return r; } + int Image::rebuild_object_map(ProgressContext &prog_ctx) + { + ImageCtx *ictx = reinterpret_cast(ctx); + return librbd::rebuild_object_map(ictx, prog_ctx); + } + int Image::copy(IoCtx& dest_io_ctx, const char *destname) { ImageCtx *ictx = (ImageCtx *)ctx; @@ -1268,6 +1274,14 @@ extern "C" int rbd_is_exclusive_lock_owner(rbd_image_t image, int *is_owner) return r; } +extern "C" int rbd_rebuild_object_map(rbd_image_t image, + librbd_progress_fn_t cb, void *cbdata) +{ + librbd::ImageCtx *ictx = reinterpret_cast(image); + librbd::CProgressContext prog_ctx(cb, cbdata); + return librbd::rebuild_object_map(ictx, prog_ctx); +} + /* snapshots */ extern "C" int rbd_snap_create(rbd_image_t image, const char *snap_name) {