]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
librbd: children should inherit parent's stripe
authorzhengyin <zhengyin@cmss.chinamoblie.com>
Mon, 16 Mar 2020 08:50:12 +0000 (16:50 +0800)
committerzhengyin <zhengyin@cmss.chinamoblie.com>
Sat, 28 Mar 2020 03:34:40 +0000 (11:34 +0800)
If the child does not specify the stripe-unit and stripe-count,
it should inherit parent's stripe.

Signed-off-by: Zheng Yin <zhengyin@cmss.chinamobile.com>
src/librbd/image/CloneRequest.cc

index 0de9f78afa4dd473af8cde1f2eac1ee9d439aa8e..ae84093e94399cd0b12c2d9ebdfa7774605f7623 100644 (file)
@@ -281,6 +281,16 @@ void CloneRequest<I>::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<I>;
   Context *ctx = create_context_callback<
     klass, &klass::handle_create_child>(this);