From: zhengyin Date: Mon, 16 Mar 2020 08:50:12 +0000 (+0800) Subject: librbd: children should inherit parent's stripe X-Git-Tag: wip-pdonnell-testing-20200918.022351~1624^2~2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=521327fb51b7df4cb3da698fa90443106c3dbd33;p=ceph-ci.git librbd: children should inherit parent's stripe If the child does not specify the stripe-unit and stripe-count, it should inherit parent's stripe. Signed-off-by: Zheng Yin --- diff --git a/src/librbd/image/CloneRequest.cc b/src/librbd/image/CloneRequest.cc index 0de9f78afa4..ae84093e943 100644 --- a/src/librbd/image/CloneRequest.cc +++ b/src/librbd/image/CloneRequest.cc @@ -281,6 +281,16 @@ void CloneRequest::create_child() { } m_opts.set(RBD_IMAGE_OPTION_FEATURES, m_features); + uint64_t stripe_unit = m_parent_image_ctx->stripe_unit; + if (m_opts.get(RBD_IMAGE_OPTION_STRIPE_UNIT, &stripe_unit) != 0) { + m_opts.set(RBD_IMAGE_OPTION_STRIPE_UNIT, stripe_unit); + } + + uint64_t stripe_count = m_parent_image_ctx->stripe_count; + if (m_opts.get(RBD_IMAGE_OPTION_STRIPE_COUNT, &stripe_count) != 0) { + m_opts.set(RBD_IMAGE_OPTION_STRIPE_COUNT, stripe_count); + } + using klass = CloneRequest; Context *ctx = create_context_callback< klass, &klass::handle_create_child>(this);