Skip to content

Commit

Permalink
Merge pull request #16238 from trociny/wip-copy-deep
Browse files Browse the repository at this point in the history
librbd: generalized deep copy function

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
  • Loading branch information
Jason Dillaman committed Nov 6, 2017
2 parents 7e5a8a7 + 3a09801 commit baa65c2
Show file tree
Hide file tree
Showing 64 changed files with 7,384 additions and 5,594 deletions.
5 changes: 5 additions & 0 deletions qa/suites/rbd/thrash/workloads/rbd_fsx_deep_copy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tasks:
- rbd_fsx:
clients: [client.0]
ops: 6000
deep_copy: True
2 changes: 2 additions & 0 deletions qa/tasks/rbd_fsx.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ def _run_one_client(ctx, config, role):
args.append('-U') # -U disables randomized striping
if not config.get('punch_holes', True):
args.append('-H') # -H disables discard ops
if config.get('deep_copy', False):
args.append('-g') # -g deep copy instead of clone
if config.get('journal_replay', False):
args.append('-j') # -j replay all IO events from journal
args.extend([
Expand Down
11 changes: 11 additions & 0 deletions src/include/rbd/librbd.h
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,17 @@ CEPH_RBD_API int rbd_copy_with_progress4(rbd_image_t image,
librbd_progress_fn_t cb, void *cbdata,
size_t sparse_size);

/* deep copy */
CEPH_RBD_API int rbd_deep_copy(rbd_image_t src, rados_ioctx_t dest_io_ctx,
const char *destname,
rbd_image_options_t dest_opts);
CEPH_RBD_API int rbd_deep_copy_with_progress(rbd_image_t image,
rados_ioctx_t dest_io_ctx,
const char *destname,
rbd_image_options_t dest_opts,
librbd_progress_fn_t cb,
void *cbdata);

/* snapshots */
CEPH_RBD_API int rbd_snap_list(rbd_image_t image, rbd_snap_info_t *snaps,
int *max_snaps);
Expand Down
5 changes: 5 additions & 0 deletions src/include/rbd/librbd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,11 @@ class CEPH_RBD_API Image
ImageOptions& opts, ProgressContext &prog_ctx,
size_t sparse_size);

/* deep copy */
int deep_copy(IoCtx& dest_io_ctx, const char *destname, ImageOptions& opts);
int deep_copy_with_progress(IoCtx& dest_io_ctx, const char *destname,
ImageOptions& opts, ProgressContext &prog_ctx);

/* striping */
uint64_t get_stripe_unit() const;
uint64_t get_stripe_count() const;
Expand Down
8 changes: 8 additions & 0 deletions src/librbd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ add_library(rbd_types STATIC
set(librbd_internal_srcs
AsyncObjectThrottle.cc
AsyncRequest.cc
DeepCopyRequest.cc
ExclusiveLock.cc
ImageCtx.cc
ImageState.cc
Expand All @@ -27,6 +28,13 @@ set(librbd_internal_srcs
api/Mirror.cc
cache/ImageWriteback.cc
cache/PassthroughImageCache.cc
deep_copy/ImageCopyRequest.cc
deep_copy/MetadataCopyRequest.cc
deep_copy/ObjectCopyRequest.cc
deep_copy/SetHeadRequest.cc
deep_copy/SnapshotCopyRequest.cc
deep_copy/SnapshotCreateRequest.cc
deep_copy/Utils.cc
exclusive_lock/AutomaticPolicy.cc
exclusive_lock/PreAcquireRequest.cc
exclusive_lock/PostAcquireRequest.cc
Expand Down

0 comments on commit baa65c2

Please sign in to comment.