From: Jason Dillaman Date: Fri, 20 Mar 2015 01:19:22 +0000 (-0400) Subject: librbd: add rebuild_object_map to public API X-Git-Tag: v9.0.1~149^2~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cc3890eea805f2d2c7cba291e8c09b5cfa7b7804;p=ceph.git librbd: add rebuild_object_map to public API Signed-off-by: Jason Dillaman --- diff --git a/src/include/rbd/librbd.h b/src/include/rbd/librbd.h index 9e54b318a07f..6a755b5d6b37 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 52c713b58bc6..ea81b8fed51a 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 60abe6a0d23a..5a2518e85859 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) {