+ if (S_ISDIR(child_mode)) {
+ if (lp->ldo_striping_cached == 0) {
+ /* we haven't tried to get default striping for
+ * the directory yet, let's cache it in the object */
+ lod_cache_parent_striping(env, lp);
+ }
+ /* transfer defaults to new directory */
+ if (lp->ldo_striping_cached) {
+ if (lp->ldo_pool)
+ lod_object_set_pool(lc, lp->ldo_pool);
+ lc->ldo_def_stripenr = lp->ldo_def_stripenr;
+ lc->ldo_def_stripe_size = lp->ldo_def_stripe_size;
+ lc->ldo_def_stripe_offset = lp->ldo_def_stripe_offset;
+ lc->ldo_striping_cached = 1;
+ lc->ldo_def_striping_set = 1;
+ CDEBUG(D_OTHER, "inherite striping defaults\n");
+ }
+ return;
+ }
+
+ /*
+ * if object is going to be striped over OSTs, transfer default
+ * striping information to the child, so that we can use it
+ * during declaration and creation
+ */
+ if (!lod_object_will_be_striped(S_ISREG(child_mode),
+ lu_object_fid(&child->do_lu)))
+ return;
+
+ /*
+ * try from the parent
+ */
+ if (likely(parent)) {
+ if (lp->ldo_striping_cached == 0) {
+ /* we haven't tried to get default striping for
+ * the directory yet, let's cache it in the object */
+ lod_cache_parent_striping(env, lp);
+ }
+
+ lc->ldo_def_stripe_offset = (__u16) -1;
+
+ if (lp->ldo_def_striping_set) {
+ if (lp->ldo_pool)
+ lod_object_set_pool(lc, lp->ldo_pool);
+ lc->ldo_stripenr = lp->ldo_def_stripenr;
+ lc->ldo_stripe_size = lp->ldo_def_stripe_size;
+ lc->ldo_def_stripe_offset = lp->ldo_def_stripe_offset;
+ CDEBUG(D_OTHER, "striping from parent: #%d, sz %d %s\n",
+ lc->ldo_stripenr, lc->ldo_stripe_size,
+ lp->ldo_pool ? lp->ldo_pool : "");
+ }
+ }
+
+ /*
+ * if the parent doesn't provide with specific pattern, grab fs-wide one
+ */
+ desc = &d->lod_desc;
+ if (lc->ldo_stripenr == 0)
+ lc->ldo_stripenr = desc->ld_default_stripe_count;
+ if (lc->ldo_stripe_size == 0)
+ lc->ldo_stripe_size = desc->ld_default_stripe_size;
+ CDEBUG(D_OTHER, "final striping: # %d stripes, sz %d from %s\n",
+ lc->ldo_stripenr, lc->ldo_stripe_size,
+ lc->ldo_pool ? lc->ldo_pool : "");
+