From 521327fb51b7df4cb3da698fa90443106c3dbd33 Mon Sep 17 00:00:00 2001 From: zhengyin Date: Mon, 16 Mar 2020 16:50:12 +0800 Subject: [PATCH] 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 --- src/librbd/image/CloneRequest.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/librbd/image/CloneRequest.cc b/src/librbd/image/CloneRequest.cc index 0de9f78afa4d..ae84093e9439 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); -- 2.47.3