librbd: add rebuild_object_map to public API

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
This commit is contained in:
Jason Dillaman 2015-03-19 21:19:22 -04:00
parent 844136d07f
commit cc3890eea8
3 changed files with 21 additions and 0 deletions

View File

@ -164,6 +164,10 @@ CEPH_RBD_API int rbd_get_flags(rbd_image_t image, uint64_t *flags);
/* exclusive lock feature */ /* exclusive lock feature */
CEPH_RBD_API int rbd_is_exclusive_lock_owner(rbd_image_t image, int *is_owner); 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, CEPH_RBD_API int rbd_copy(rbd_image_t image, rados_ioctx_t dest_io_ctx,
const char *destname); const char *destname);
CEPH_RBD_API int rbd_copy2(rbd_image_t src, rbd_image_t dest); CEPH_RBD_API int rbd_copy2(rbd_image_t src, rbd_image_t dest);

View File

@ -123,6 +123,9 @@ public:
/* exclusive lock feature */ /* exclusive lock feature */
int is_exclusive_lock_owner(bool *is_owner); 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 copy(IoCtx& dest_io_ctx, const char *destname);
int copy2(Image& dest); int copy2(Image& dest);
int copy_with_progress(IoCtx& dest_io_ctx, const char *destname, int copy_with_progress(IoCtx& dest_io_ctx, const char *destname,

View File

@ -387,6 +387,12 @@ namespace librbd {
return r; return r;
} }
int Image::rebuild_object_map(ProgressContext &prog_ctx)
{
ImageCtx *ictx = reinterpret_cast<ImageCtx*>(ctx);
return librbd::rebuild_object_map(ictx, prog_ctx);
}
int Image::copy(IoCtx& dest_io_ctx, const char *destname) int Image::copy(IoCtx& dest_io_ctx, const char *destname)
{ {
ImageCtx *ictx = (ImageCtx *)ctx; 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; 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<librbd::ImageCtx*>(image);
librbd::CProgressContext prog_ctx(cb, cbdata);
return librbd::rebuild_object_map(ictx, prog_ctx);
}
/* snapshots */ /* snapshots */
extern "C" int rbd_snap_create(rbd_image_t image, const char *snap_name) extern "C" int rbd_snap_create(rbd_image_t image, const char *snap_name)
{ {