+ struct lov_user_md_v1 *v1 = NULL;
+ struct lov_user_md_v3 *v3 = NULL;
+ struct lov_comp_md_v1 *comp_v1 = NULL;
+ __u16 comp_cnt;
+ __u16 mirror_cnt;
+ bool composite;
+ int rc, i;
+ ENTRY;
+
+ lds->lds_def_striping_set = 0;
+
+ rc = lod_get_lov_ea(env, lo);
+ if (rc < 0)
+ RETURN(rc);
+
+ if (rc < (typeof(rc))sizeof(struct lov_user_md))
+ RETURN(0);
+
+ v1 = info->lti_ea_store;
+ if (v1->lmm_magic == __swab32(LOV_USER_MAGIC_V1)) {
+ lustre_swab_lov_user_md_v1(v1);
+ } else if (v1->lmm_magic == __swab32(LOV_USER_MAGIC_V3)) {
+ v3 = (struct lov_user_md_v3 *)v1;
+ lustre_swab_lov_user_md_v3(v3);
+ } else if (v1->lmm_magic == __swab32(LOV_USER_MAGIC_COMP_V1)) {
+ comp_v1 = (struct lov_comp_md_v1 *)v1;
+ lustre_swab_lov_comp_md_v1(comp_v1);
+ }
+
+ if (v1->lmm_magic != LOV_MAGIC_V3 && v1->lmm_magic != LOV_MAGIC_V1 &&
+ v1->lmm_magic != LOV_MAGIC_COMP_V1)
+ RETURN(-ENOTSUPP);
+
+ if (v1->lmm_magic == LOV_MAGIC_COMP_V1) {
+ comp_v1 = (struct lov_comp_md_v1 *)v1;
+ comp_cnt = comp_v1->lcm_entry_count;
+ if (comp_cnt == 0)
+ RETURN(-EINVAL);
+ mirror_cnt = comp_v1->lcm_mirror_count + 1;
+ composite = true;
+ } else {
+ comp_cnt = 1;
+ mirror_cnt = 0;
+ composite = false;
+ }
+
+ /* realloc default comp entries if necessary */
+ rc = lod_def_striping_comp_resize(lds, comp_cnt);
+ if (rc < 0)
+ RETURN(rc);
+
+ lds->lds_def_comp_cnt = comp_cnt;
+ lds->lds_def_striping_is_composite = composite;
+ lds->lds_def_mirror_cnt = mirror_cnt;
+
+ for (i = 0; i < comp_cnt; i++) {
+ struct lod_layout_component *lod_comp;
+ struct lu_extent *ext;
+ char *pool;
+
+ lod_comp = &lds->lds_def_comp_entries[i];
+ /*
+ * reset lod_comp values, llc_stripes is always NULL in
+ * the default striping template, llc_pool will be reset
+ * later below.
+ */
+ memset(lod_comp, 0, offsetof(typeof(*lod_comp), llc_pool));
+
+ if (composite) {
+ v1 = (struct lov_user_md *)((char *)comp_v1 +
+ comp_v1->lcm_entries[i].lcme_offset);
+ ext = &comp_v1->lcm_entries[i].lcme_extent;
+ lod_comp->llc_extent = *ext;
+ }
+
+ if (v1->lmm_pattern != LOV_PATTERN_RAID0 &&
+ v1->lmm_pattern != LOV_PATTERN_MDT &&
+ v1->lmm_pattern != 0) {
+ lod_free_def_comp_entries(lds);
+ RETURN(-EINVAL);
+ }
+
+ CDEBUG(D_LAYOUT, DFID" stripe_count=%d stripe_size=%d "
+ "stripe_offset=%d\n",
+ PFID(lu_object_fid(&lo->ldo_obj.do_lu)),
+ (int)v1->lmm_stripe_count, (int)v1->lmm_stripe_size,
+ (int)v1->lmm_stripe_offset);
+
+ lod_comp->llc_stripe_count = v1->lmm_stripe_count;
+ lod_comp->llc_stripe_size = v1->lmm_stripe_size;
+ lod_comp->llc_stripe_offset = v1->lmm_stripe_offset;
+ lod_comp->llc_pattern = v1->lmm_pattern;
+
+ pool = NULL;
+ if (v1->lmm_magic == LOV_USER_MAGIC_V3) {
+ /* XXX: sanity check here */
+ v3 = (struct lov_user_md_v3 *) v1;
+ if (v3->lmm_pool_name[0] != '\0')
+ pool = v3->lmm_pool_name;
+ }
+ lod_set_def_pool(lds, i, pool);
+ }
+
+ lds->lds_def_striping_set = 1;
+ RETURN(rc);
+}
+
+/**
+ * Get default directory striping.
+ *
+ * \param[in] env execution environment
+ * \param[in] lo object
+ * \param[out] lds default striping
+ *
+ * \retval 0 on success
+ * \retval negative if failed
+ */
+static int lod_get_default_lmv_striping(const struct lu_env *env,
+ struct lod_object *lo,
+ struct lod_default_striping *lds)
+{
+ struct lod_thread_info *info = lod_env_info(env);
+ struct lmv_user_md_v1 *v1 = NULL;
+ int rc;
+ ENTRY;
+
+ lds->lds_dir_def_striping_set = 0;
+ rc = lod_get_default_lmv_ea(env, lo);
+ if (rc < 0)
+ RETURN(rc);
+
+ if (rc < (typeof(rc))sizeof(struct lmv_user_md))
+ RETURN(0);
+
+ v1 = info->lti_ea_store;
+
+ lds->lds_dir_def_stripe_count = le32_to_cpu(v1->lum_stripe_count);
+ lds->lds_dir_def_stripe_offset = le32_to_cpu(v1->lum_stripe_offset);
+ lds->lds_dir_def_hash_type = le32_to_cpu(v1->lum_hash_type);
+ lds->lds_dir_def_striping_set = 1;
+
+ RETURN(0);
+}
+
+/**
+ * Get default striping in the object.
+ *
+ * Get object default striping and default directory striping.
+ *
+ * \param[in] env execution environment
+ * \param[in] lo object
+ * \param[out] lds default striping
+ *
+ * \retval 0 on success
+ * \retval negative if failed
+ */
+static int lod_get_default_striping(const struct lu_env *env,
+ struct lod_object *lo,
+ struct lod_default_striping *lds)
+{
+ int rc, rc1;
+
+ rc = lod_get_default_lov_striping(env, lo, lds);
+ rc1 = lod_get_default_lmv_striping(env, lo, lds);
+ if (rc == 0 && rc1 < 0)
+ rc = rc1;
+
+ return rc;
+}
+
+/**
+ * Apply default striping on object.
+ *
+ * If object striping pattern is not set, set to the one in default striping.
+ * The default striping is from parent or fs.
+ *
+ * \param[in] lo new object
+ * \param[in] lds default striping
+ * \param[in] mode new object's mode
+ */
+static void lod_striping_from_default(struct lod_object *lo,
+ const struct lod_default_striping *lds,
+ umode_t mode)
+{
+ struct lod_device *d = lu2lod_dev(lo->ldo_obj.do_lu.lo_dev);
+ struct lov_desc *desc = &d->lod_desc;
+ int i, rc;
+
+ if (lds->lds_def_striping_set && S_ISREG(mode)) {
+ rc = lod_alloc_comp_entries(lo, lds->lds_def_mirror_cnt,
+ lds->lds_def_comp_cnt);
+ if (rc != 0)
+ return;
+
+ lo->ldo_is_composite = lds->lds_def_striping_is_composite;
+ if (lds->lds_def_mirror_cnt > 1)
+ lo->ldo_flr_state = LCM_FL_RDONLY;
+
+ for (i = 0; i < lo->ldo_comp_cnt; i++) {
+ struct lod_layout_component *obj_comp =
+ &lo->ldo_comp_entries[i];
+ struct lod_layout_component *def_comp =
+ &lds->lds_def_comp_entries[i];
+
+ CDEBUG(D_LAYOUT, "Inherite from default: size:%hu "
+ "nr:%u offset:%u pattern %#x %s\n",
+ def_comp->llc_stripe_size,
+ def_comp->llc_stripe_count,
+ def_comp->llc_stripe_offset,
+ def_comp->llc_pattern,
+ def_comp->llc_pool ?: "");
+
+ *obj_comp = *def_comp;
+ if (def_comp->llc_pool != NULL) {
+ /* pointer was copied from def_comp */
+ obj_comp->llc_pool = NULL;
+ lod_obj_set_pool(lo, i, def_comp->llc_pool);
+ }
+
+ /*
+ * Don't initialize these fields for plain layout
+ * (v1/v3) here, they are inherited in the order of
+ * 'parent' -> 'fs default (root)' -> 'global default
+ * values for stripe_count & stripe_size'.
+ *
+ * see lod_ah_init().
+ */
+ if (!lo->ldo_is_composite)
+ continue;
+
+ lod_adjust_stripe_info(obj_comp, desc);
+ }
+ } else if (lds->lds_dir_def_striping_set && S_ISDIR(mode)) {
+ if (lo->ldo_dir_stripe_count == 0)
+ lo->ldo_dir_stripe_count =
+ lds->lds_dir_def_stripe_count;
+ if (lo->ldo_dir_stripe_offset == -1)
+ lo->ldo_dir_stripe_offset =
+ lds->lds_dir_def_stripe_offset;
+ if (lo->ldo_dir_hash_type == 0)
+ lo->ldo_dir_hash_type = lds->lds_dir_def_hash_type;
+
+ CDEBUG(D_LAYOUT, "striping from default dir: count:%hu, "
+ "offset:%u, hash_type:%u\n",
+ lo->ldo_dir_stripe_count, lo->ldo_dir_stripe_offset,
+ lo->ldo_dir_hash_type);
+ }
+}
+
+static inline bool lod_need_inherit_more(struct lod_object *lo, bool from_root)
+{
+ struct lod_layout_component *lod_comp;
+
+ if (lo->ldo_comp_cnt == 0)
+ return true;
+
+ if (lo->ldo_is_composite)
+ return false;
+
+ lod_comp = &lo->ldo_comp_entries[0];
+
+ if (lod_comp->llc_stripe_count <= 0 ||
+ lod_comp->llc_stripe_size <= 0)
+ return true;
+
+ if (from_root && (lod_comp->llc_pool == NULL ||
+ lod_comp->llc_stripe_offset == LOV_OFFSET_DEFAULT))
+ return true;
+
+ return false;
+}
+
+/**
+ * Implementation of dt_object_operations::do_ah_init.
+ *
+ * This method is used to make a decision on the striping configuration for the
+ * object being created. It can be taken from the \a parent object if it exists,
+ * or filesystem's default. The resulting configuration (number of stripes,
+ * stripe size/offset, pool name, etc) is stored in the object itself and will
+ * be used by the methods like ->doo_declare_create().
+ *
+ * \see dt_object_operations::do_ah_init() in the API description for details.
+ */
+static void lod_ah_init(const struct lu_env *env,
+ struct dt_allocation_hint *ah,
+ struct dt_object *parent,
+ struct dt_object *child,
+ umode_t child_mode)
+{
+ struct lod_device *d = lu2lod_dev(child->do_lu.lo_dev);
+ struct lod_thread_info *info = lod_env_info(env);
+ struct lod_default_striping *lds = &info->lti_def_striping;
+ struct dt_object *nextp = NULL;
+ struct dt_object *nextc;
+ struct lod_object *lp = NULL;
+ struct lod_object *lc;
+ struct lov_desc *desc;
+ struct lod_layout_component *lod_comp;
+ int rc;
+ ENTRY;
+
+ LASSERT(child);
+
+ if (likely(parent)) {
+ nextp = dt_object_child(parent);
+ lp = lod_dt_obj(parent);
+ }
+
+ nextc = dt_object_child(child);
+ lc = lod_dt_obj(child);
+
+ LASSERT(!lod_obj_is_striped(child));
+ /* default layout template may have been set on the regular file
+ * when this is called from mdd_create_data() */
+ if (S_ISREG(child_mode))
+ lod_free_comp_entries(lc);
+
+ if (!dt_object_exists(nextc))
+ nextc->do_ops->do_ah_init(env, ah, nextp, nextc, child_mode);
+
+ if (S_ISDIR(child_mode)) {
+ const struct lmv_user_md_v1 *lum1 = ah->dah_eadata;
+
+ /* other default values are 0 */
+ lc->ldo_dir_stripe_offset = -1;
+
+ /* get default striping from parent object */
+ if (likely(lp != NULL))
+ lod_get_default_striping(env, lp, lds);
+
+ /* set child default striping info, default value is NULL */
+ if (lds->lds_def_striping_set || lds->lds_dir_def_striping_set)
+ lc->ldo_def_striping = lds;
+
+ /* It should always honour the specified stripes */
+ /* Note: old client (< 2.7)might also do lfs mkdir, whose EA
+ * will have old magic. In this case, we should ignore the
+ * stripe count and try to create dir by default stripe.
+ */
+ if (ah->dah_eadata != NULL && ah->dah_eadata_len != 0 &&
+ (le32_to_cpu(lum1->lum_magic) == LMV_USER_MAGIC ||
+ le32_to_cpu(lum1->lum_magic) == LMV_USER_MAGIC_SPECIFIC)) {
+ lc->ldo_dir_stripe_count =
+ le32_to_cpu(lum1->lum_stripe_count);
+ lc->ldo_dir_stripe_offset =
+ le32_to_cpu(lum1->lum_stripe_offset);
+ lc->ldo_dir_hash_type =
+ le32_to_cpu(lum1->lum_hash_type);
+ CDEBUG(D_INFO,
+ "set dirstripe: count %hu, offset %d, hash %u\n",
+ lc->ldo_dir_stripe_count,
+ (int)lc->ldo_dir_stripe_offset,
+ lc->ldo_dir_hash_type);
+ } else {
+ /* transfer defaults LMV to new directory */
+ lod_striping_from_default(lc, lds, child_mode);
+ }
+
+ /* shrink the stripe_count to the avaible MDT count */
+ if (lc->ldo_dir_stripe_count > d->lod_remote_mdt_count + 1 &&
+ !OBD_FAIL_CHECK(OBD_FAIL_LARGE_STRIPE))
+ lc->ldo_dir_stripe_count = d->lod_remote_mdt_count + 1;
+
+ /* Directory will be striped only if stripe_count > 1, if
+ * stripe_count == 1, let's reset stripe_count = 0 to avoid
+ * create single master stripe and also help to unify the
+ * stripe handling of directories and files */
+ if (lc->ldo_dir_stripe_count == 1)
+ lc->ldo_dir_stripe_count = 0;
+
+ CDEBUG(D_INFO, "final dir stripe [%hu %d %u]\n",
+ lc->ldo_dir_stripe_count,
+ (int)lc->ldo_dir_stripe_offset, lc->ldo_dir_hash_type);
+
+ RETURN_EXIT;
+ }
+
+ /* child object regular file*/
+
+ if (!lod_object_will_be_striped(S_ISREG(child_mode),
+ lu_object_fid(&child->do_lu)))
+ RETURN_EXIT;
+
+ /* 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.
+ *
+ * Try from the parent first.
+ */
+ if (likely(lp != NULL)) {
+ rc = lod_get_default_lov_striping(env, lp, lds);
+ if (rc == 0)
+ lod_striping_from_default(lc, lds, child_mode);
+ }
+
+ /* Initialize lod_device::lod_md_root object reference */
+ if (d->lod_md_root == NULL) {
+ struct dt_object *root;
+ struct lod_object *lroot;
+
+ lu_root_fid(&info->lti_fid);
+ root = dt_locate(env, &d->lod_dt_dev, &info->lti_fid);
+ if (!IS_ERR(root)) {
+ lroot = lod_dt_obj(root);
+
+ spin_lock(&d->lod_lock);
+ if (d->lod_md_root != NULL)
+ dt_object_put(env, &d->lod_md_root->ldo_obj);
+ d->lod_md_root = lroot;
+ spin_unlock(&d->lod_lock);
+ }
+ }
+
+ /* try inherit layout from the root object (fs default) when:
+ * - parent does not have default layout; or
+ * - parent has plain(v1/v3) default layout, and some attributes
+ * are not specified in the default layout;
+ */
+ if (d->lod_md_root != NULL && lod_need_inherit_more(lc, true)) {
+ rc = lod_get_default_lov_striping(env, d->lod_md_root, lds);
+ if (rc)
+ goto out;
+ if (lc->ldo_comp_cnt == 0) {
+ lod_striping_from_default(lc, lds, child_mode);
+ } else if (!lds->lds_def_striping_is_composite) {
+ struct lod_layout_component *def_comp;
+
+ LASSERT(!lc->ldo_is_composite);
+ lod_comp = &lc->ldo_comp_entries[0];
+ def_comp = &lds->lds_def_comp_entries[0];
+
+ if (lod_comp->llc_stripe_count <= 0)
+ lod_comp->llc_stripe_count =
+ def_comp->llc_stripe_count;
+ if (lod_comp->llc_stripe_size <= 0)
+ lod_comp->llc_stripe_size =
+ def_comp->llc_stripe_size;
+ if (lod_comp->llc_stripe_offset == LOV_OFFSET_DEFAULT)
+ lod_comp->llc_stripe_offset =
+ def_comp->llc_stripe_offset;
+ if (lod_comp->llc_pool == NULL)
+ lod_obj_set_pool(lc, 0, def_comp->llc_pool);
+ }
+ }
+out:
+ /*
+ * fs default striping may not be explicitly set, or historically set
+ * in config log, use them.
+ */
+ if (lod_need_inherit_more(lc, false)) {
+ if (lc->ldo_comp_cnt == 0) {
+ rc = lod_alloc_comp_entries(lc, 0, 1);
+ if (rc)
+ /* fail to allocate memory, will create a
+ * non-striped file. */
+ RETURN_EXIT;
+ lc->ldo_is_composite = 0;
+ lod_comp = &lc->ldo_comp_entries[0];
+ lod_comp->llc_stripe_offset = LOV_OFFSET_DEFAULT;
+ }
+ LASSERT(!lc->ldo_is_composite);
+ lod_comp = &lc->ldo_comp_entries[0];
+ desc = &d->lod_desc;
+ lod_adjust_stripe_info(lod_comp, desc);
+ }
+
+ EXIT;
+}
+
+#define ll_do_div64(aaa,bbb) do_div((aaa), (bbb))
+/**
+ * Size initialization on late striping.
+ *
+ * Propagate the size of a truncated object to a deferred striping.
+ * This function handles a special case when truncate was done on a
+ * non-striped object and now while the striping is being created
+ * we can't lose that size, so we have to propagate it to the stripes
+ * being created.
+ *
+ * \param[in] env execution environment
+ * \param[in] dt object
+ * \param[in] th transaction handle
+ *
+ * \retval 0 on success
+ * \retval negative if failed
+ */
+static int lod_declare_init_size(const struct lu_env *env,
+ struct dt_object *dt, struct thandle *th)
+{
+ struct dt_object *next = dt_object_child(dt);
+ struct lod_object *lo = lod_dt_obj(dt);
+ struct dt_object **objects = NULL;
+ struct lu_attr *attr = &lod_env_info(env)->lti_attr;
+ uint64_t size, offs;
+ int i, rc, stripe, stripe_count = 0, stripe_size = 0;
+ struct lu_extent size_ext;
+ ENTRY;
+
+ if (!lod_obj_is_striped(dt))
+ RETURN(0);
+
+ rc = dt_attr_get(env, next, attr);
+ LASSERT(attr->la_valid & LA_SIZE);
+ if (rc)
+ RETURN(rc);
+
+ size = attr->la_size;
+ if (size == 0)
+ RETURN(0);
+
+ size_ext = (typeof(size_ext)){ .e_start = size - 1, .e_end = size };
+ for (i = 0; i < lo->ldo_comp_cnt; i++) {
+ struct lod_layout_component *lod_comp;
+ struct lu_extent *extent;
+
+ lod_comp = &lo->ldo_comp_entries[i];
+
+ if (lod_comp->llc_stripe == NULL)
+ continue;
+
+ extent = &lod_comp->llc_extent;
+ CDEBUG(D_INFO, "%lld "DEXT"\n", size, PEXT(extent));
+ if (!lo->ldo_is_composite ||
+ lu_extent_is_overlapped(extent, &size_ext)) {
+ objects = lod_comp->llc_stripe;
+ stripe_count = lod_comp->llc_stripe_count;
+ stripe_size = lod_comp->llc_stripe_size;
+
+ /* next mirror */
+ if (stripe_count == 0)
+ continue;
+
+ LASSERT(objects != NULL && stripe_size != 0);
+ /* ll_do_div64(a, b) returns a % b, and a = a / b */
+ ll_do_div64(size, (__u64)stripe_size);
+ stripe = ll_do_div64(size, (__u64)stripe_count);
+ LASSERT(objects[stripe] != NULL);
+
+ size = size * stripe_size;
+ offs = attr->la_size;
+ size += ll_do_div64(offs, stripe_size);
+
+ attr->la_valid = LA_SIZE;
+ attr->la_size = size;
+
+ rc = lod_sub_declare_attr_set(env, objects[stripe],
+ attr, th);
+ }
+ }
+
+ RETURN(rc);
+}
+
+/**
+ * Declare creation of striped object.
+ *
+ * The function declares creation stripes for a regular object. The function
+ * also declares whether the stripes will be created with non-zero size if
+ * previously size was set non-zero on the master object. If object \a dt is
+ * not local, then only fully defined striping can be applied in \a lovea.
+ * Otherwise \a lovea can be in the form of pattern, see lod_qos_parse_config()
+ * for the details.
+ *
+ * \param[in] env execution environment
+ * \param[in] dt object
+ * \param[in] attr attributes the stripes will be created with
+ * \param[in] lovea a buffer containing striping description
+ * \param[in] th transaction handle
+ *
+ * \retval 0 on success
+ * \retval negative if failed
+ */
+int lod_declare_striped_create(const struct lu_env *env, struct dt_object *dt,
+ struct lu_attr *attr,
+ const struct lu_buf *lovea, struct thandle *th)
+{
+ struct lod_thread_info *info = lod_env_info(env);
+ struct dt_object *next = dt_object_child(dt);
+ struct lod_object *lo = lod_dt_obj(dt);
+ int rc;
+ ENTRY;
+
+ if (OBD_FAIL_CHECK(OBD_FAIL_MDS_ALLOC_OBDO))
+ GOTO(out, rc = -ENOMEM);
+
+ if (!dt_object_remote(next)) {
+ /* choose OST and generate appropriate objects */
+ rc = lod_prepare_create(env, lo, attr, lovea, th);
+ if (rc)
+ GOTO(out, rc);
+
+ /*
+ * declare storage for striping data
+ */
+ info->lti_buf.lb_len = lod_comp_md_size(lo, false);
+ } else {
+ /* LOD can not choose OST objects for remote objects, i.e.
+ * stripes must be ready before that. Right now, it can only
+ * happen during migrate, i.e. migrate process needs to create
+ * remote regular file (mdd_migrate_create), then the migrate
+ * process will provide stripeEA. */
+ LASSERT(lovea != NULL);
+ info->lti_buf = *lovea;
+ }
+
+ rc = lod_sub_declare_xattr_set(env, next, &info->lti_buf,
+ XATTR_NAME_LOV, 0, th);
+ if (rc)
+ GOTO(out, rc);
+
+ /*
+ * if striping is created with local object's size > 0,
+ * we have to propagate this size to specific object
+ * the case is possible only when local object was created previously
+ */
+ if (dt_object_exists(next))
+ rc = lod_declare_init_size(env, dt, th);
+
+out:
+ /* failed to create striping or to set initial size, let's reset
+ * config so that others don't get confused */
+ if (rc)
+ lod_object_free_striping(env, lo);
+
+ RETURN(rc);
+}
+
+/**
+ * Implementation of dt_object_operations::do_declare_create.
+ *
+ * The method declares creation of a new object. If the object will be striped,
+ * then helper functions are called to find FIDs for the stripes, declare
+ * creation of the stripes and declare initialization of the striping
+ * information to be stored in the master object.
+ *
+ * \see dt_object_operations::do_declare_create() in the API description
+ * for details.
+ */
+static int lod_declare_create(const struct lu_env *env, struct dt_object *dt,
+ struct lu_attr *attr,
+ struct dt_allocation_hint *hint,
+ struct dt_object_format *dof, struct thandle *th)
+{
+ struct dt_object *next = dt_object_child(dt);
+ struct lod_object *lo = lod_dt_obj(dt);
+ int rc;
+ ENTRY;
+
+ LASSERT(dof);
+ LASSERT(attr);
+ LASSERT(th);
+
+ /*
+ * first of all, we declare creation of local object
+ */
+ rc = lod_sub_declare_create(env, next, attr, hint, dof, th);
+ if (rc != 0)
+ GOTO(out, rc);
+
+ /*
+ * it's lod_ah_init() that has decided the object will be striped
+ */
+ if (dof->dof_type == DFT_REGULAR) {
+ /* callers don't want stripes */
+ /* XXX: all tricky interactions with ->ah_make_hint() decided
+ * to use striping, then ->declare_create() behaving differently
+ * should be cleaned */
+ if (dof->u.dof_reg.striped != 0)
+ rc = lod_declare_striped_create(env, dt, attr,
+ NULL, th);
+ } else if (dof->dof_type == DFT_DIR) {
+ struct seq_server_site *ss;
+ struct lu_buf buf = { NULL };
+ struct lu_buf *lmu = NULL;
+
+ ss = lu_site2seq(dt->do_lu.lo_dev->ld_site);
+
+ /* If the parent has default stripeEA, and client
+ * did not find it before sending create request,
+ * then MDT will return -EREMOTE, and client will
+ * retrieve the default stripeEA and re-create the
+ * sub directory.
+ *
+ * Note: if dah_eadata != NULL, it means creating the
+ * striped directory with specified stripeEA, then it
+ * should ignore the default stripeEA */
+ if (hint != NULL && hint->dah_eadata == NULL) {
+ if (OBD_FAIL_CHECK(OBD_FAIL_MDS_STALE_DIR_LAYOUT))
+ GOTO(out, rc = -EREMOTE);
+
+ if (lo->ldo_dir_stripe_offset == -1) {
+ /* child and parent should be in the same MDT */
+ if (hint->dah_parent != NULL &&
+ dt_object_remote(hint->dah_parent))
+ GOTO(out, rc = -EREMOTE);
+ } else if (lo->ldo_dir_stripe_offset !=
+ ss->ss_node_id) {
+ struct lod_device *lod;
+ struct lod_tgt_descs *ltd;
+ struct lod_tgt_desc *tgt = NULL;
+ bool found_mdt = false;
+ int i;
+
+ lod = lu2lod_dev(lo->ldo_obj.do_lu.lo_dev);
+ ltd = &lod->lod_mdt_descs;
+ cfs_foreach_bit(ltd->ltd_tgt_bitmap, i) {
+ tgt = LTD_TGT(ltd, i);
+ if (tgt->ltd_index ==
+ lo->ldo_dir_stripe_offset) {
+ found_mdt = true;
+ break;
+ }
+ }
+
+ /* If the MDT indicated by stripe_offset can be
+ * found, then tell client to resend the create
+ * request to the correct MDT, otherwise return
+ * error to client */
+ if (found_mdt)
+ GOTO(out, rc = -EREMOTE);
+ else
+ GOTO(out, rc = -EINVAL);
+ }
+ } else if (hint && hint->dah_eadata) {
+ lmu = &buf;
+ lmu->lb_buf = (void *)hint->dah_eadata;
+ lmu->lb_len = hint->dah_eadata_len;
+ }
+
+ rc = lod_declare_dir_striping_create(env, dt, attr, lmu, dof,
+ th);
+ }
+out:
+ /* failed to create striping or to set initial size, let's reset
+ * config so that others don't get confused */
+ if (rc)
+ lod_object_free_striping(env, lo);
+ RETURN(rc);
+}
+
+/**
+ * Generate component ID for new created component.
+ *
+ * \param[in] lo LOD object
+ * \param[in] comp_idx index of ldo_comp_entries
+ *
+ * \retval component ID on success
+ * \retval LCME_ID_INVAL on failure
+ */
+static __u32 lod_gen_component_id(struct lod_object *lo,
+ int mirror_id, int comp_idx)
+{
+ struct lod_layout_component *lod_comp;
+ __u32 id, start, end;
+ int i;
+
+ LASSERT(lo->ldo_comp_entries[comp_idx].llc_id == LCME_ID_INVAL);
+
+ lod_obj_inc_layout_gen(lo);
+ id = lo->ldo_layout_gen;
+ if (likely(id <= SEQ_ID_MAX))
+ RETURN(pflr_id(mirror_id, id & SEQ_ID_MASK));
+
+ /* Layout generation wraps, need to check collisions. */
+ start = id & SEQ_ID_MASK;
+ end = SEQ_ID_MAX;
+again:
+ for (id = start; id <= end; id++) {
+ for (i = 0; i < lo->ldo_comp_cnt; i++) {
+ lod_comp = &lo->ldo_comp_entries[i];
+ if (pflr_id(mirror_id, id) == lod_comp->llc_id)
+ break;
+ }
+ /* Found the ununsed ID */
+ if (i == lo->ldo_comp_cnt)
+ RETURN(pflr_id(mirror_id, id));
+ }
+ if (end == LCME_ID_MAX) {
+ start = 1;
+ end = min(lo->ldo_layout_gen & LCME_ID_MASK,
+ (__u32)(LCME_ID_MAX - 1));
+ goto again;
+ }
+
+ RETURN(LCME_ID_INVAL);
+}
+
+/**
+ * Creation of a striped regular object.
+ *
+ * The function is called to create the stripe objects for a regular
+ * striped file. This can happen at the initial object creation or
+ * when the caller asks LOD to do so using ->do_xattr_set() method
+ * (so called late striping). Notice all the information are already
+ * prepared in the form of the list of objects (ldo_stripe field).
+ * This is done during declare phase.
+ *
+ * \param[in] env execution environment
+ * \param[in] dt object
+ * \param[in] attr attributes the stripes will be created with
+ * \param[in] dof format of stripes (see OSD API description)
+ * \param[in] th transaction handle
+ *
+ * \retval 0 on success
+ * \retval negative if failed
+ */
+int lod_striped_create(const struct lu_env *env, struct dt_object *dt,
+ struct lu_attr *attr, struct dt_object_format *dof,
+ struct thandle *th)
+{
+ struct lod_layout_component *lod_comp;
+ struct lod_object *lo = lod_dt_obj(dt);
+ __u16 mirror_id;
+ int rc = 0, i, j;
+ ENTRY;
+
+ LASSERT(lo->ldo_comp_cnt != 0 && lo->ldo_comp_entries != NULL);
+
+ mirror_id = lo->ldo_mirror_count > 1 ? 1 : 0;
+
+ /* create all underlying objects */
+ for (i = 0; i < lo->ldo_comp_cnt; i++) {
+ lod_comp = &lo->ldo_comp_entries[i];
+
+ if (lod_comp->llc_extent.e_start == 0 && i > 0) /* new mirror */
+ ++mirror_id;
+
+ if (lod_comp->llc_id == LCME_ID_INVAL) {
+ lod_comp->llc_id = lod_gen_component_id(lo,
+ mirror_id, i);
+ if (lod_comp->llc_id == LCME_ID_INVAL)
+ GOTO(out, rc = -ERANGE);
+ }
+
+ if (lod_comp_inited(lod_comp))
+ continue;
+
+ if (lod_comp->llc_pattern & LOV_PATTERN_F_RELEASED)
+ lod_comp_set_init(lod_comp);
+
+ if (lov_pattern(lod_comp->llc_pattern) == LOV_PATTERN_MDT)
+ lod_comp_set_init(lod_comp);
+
+ if (lod_comp->llc_stripe == NULL)
+ continue;
+
+ LASSERT(lod_comp->llc_stripe_count);
+ for (j = 0; j < lod_comp->llc_stripe_count; j++) {
+ struct dt_object *object = lod_comp->llc_stripe[j];
+ LASSERT(object != NULL);
+ rc = lod_sub_create(env, object, attr, NULL, dof, th);
+ if (rc)
+ GOTO(out, rc);
+ }
+ lod_comp_set_init(lod_comp);
+ }
+
+ rc = lod_fill_mirrors(lo);
+ if (rc)
+ GOTO(out, rc);
+
+ rc = lod_generate_and_set_lovea(env, lo, th);
+ if (rc)
+ GOTO(out, rc);
+
+ lo->ldo_comp_cached = 1;
+ RETURN(0);
+
+out:
+ lod_object_free_striping(env, lo);
+ RETURN(rc);
+}
+
+/**
+ * Implementation of dt_object_operations::do_create.
+ *
+ * If any of preceeding methods (like ->do_declare_create(),
+ * ->do_ah_init(), etc) chose to create a striped object,
+ * then this method will create the master and the stripes.
+ *
+ * \see dt_object_operations::do_create() in the API description for details.
+ */
+static int lod_create(const struct lu_env *env, struct dt_object *dt,
+ struct lu_attr *attr, struct dt_allocation_hint *hint,
+ struct dt_object_format *dof, struct thandle *th)
+{
+ int rc;
+ ENTRY;
+
+ /* create local object */
+ rc = lod_sub_create(env, dt_object_child(dt), attr, hint, dof, th);
+ if (rc != 0)
+ RETURN(rc);
+
+ if (S_ISREG(dt->do_lu.lo_header->loh_attr) &&
+ lod_obj_is_striped(dt) && dof->u.dof_reg.striped != 0) {
+ LASSERT(lod_dt_obj(dt)->ldo_comp_cached == 0);
+ rc = lod_striped_create(env, dt, attr, dof, th);
+ }
+
+ RETURN(rc);
+}
+
+static inline int
+lod_obj_stripe_destroy_cb(const struct lu_env *env, struct lod_object *lo,
+ struct dt_object *dt, struct thandle *th,
+ int comp_idx, int stripe_idx,
+ struct lod_obj_stripe_cb_data *data)
+{
+ if (data->locd_declare)
+ return lod_sub_declare_destroy(env, dt, th);
+ else if (!OBD_FAIL_CHECK(OBD_FAIL_LFSCK_LOST_SPEOBJ) ||
+ stripe_idx == cfs_fail_val)
+ return lod_sub_destroy(env, dt, th);
+ else
+ return 0;
+}
+
+/**
+ * Implementation of dt_object_operations::do_declare_destroy.
+ *
+ * If the object is a striped directory, then the function declares reference
+ * removal from the master object (this is an index) to the stripes and declares
+ * destroy of all the stripes. In all the cases, it declares an intention to
+ * destroy the object itself.
+ *
+ * \see dt_object_operations::do_declare_destroy() in the API description
+ * for details.
+ */
+static int lod_declare_destroy(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *th)
+{
+ struct dt_object *next = dt_object_child(dt);
+ struct lod_object *lo = lod_dt_obj(dt);
+ struct lod_thread_info *info = lod_env_info(env);
+ char *stripe_name = info->lti_key;
+ int rc, i;
+ ENTRY;
+
+ /*
+ * load striping information, notice we don't do this when object
+ * is being initialized as we don't need this information till
+ * few specific cases like destroy, chown
+ */
+ rc = lod_load_striping(env, lo);
+ if (rc)
+ RETURN(rc);
+
+ /* declare destroy for all underlying objects */
+ if (S_ISDIR(dt->do_lu.lo_header->loh_attr)) {
+ rc = next->do_ops->do_index_try(env, next,
+ &dt_directory_features);
+ if (rc != 0)
+ RETURN(rc);
+
+ for (i = 0; i < lo->ldo_dir_stripe_count; i++) {
+ rc = lod_sub_declare_ref_del(env, next, th);
+ if (rc != 0)
+ RETURN(rc);
+
+ snprintf(stripe_name, sizeof(info->lti_key), DFID":%d",
+ PFID(lu_object_fid(&lo->ldo_stripe[i]->do_lu)),
+ i);
+ rc = lod_sub_declare_delete(env, next,
+ (const struct dt_key *)stripe_name, th);
+ if (rc != 0)
+ RETURN(rc);
+ }
+ }
+
+ /*
+ * we declare destroy for the local object
+ */
+ rc = lod_sub_declare_destroy(env, next, th);
+ if (rc)
+ RETURN(rc);
+
+ if (OBD_FAIL_CHECK(OBD_FAIL_LFSCK_LOST_MDTOBJ) ||
+ OBD_FAIL_CHECK(OBD_FAIL_LFSCK_LOST_MDTOBJ2))
+ RETURN(0);
+
+ if (!lod_obj_is_striped(dt))
+ RETURN(0);
+
+ /* declare destroy all striped objects */
+ if (S_ISDIR(dt->do_lu.lo_header->loh_attr)) {
+ for (i = 0; i < lo->ldo_dir_stripe_count; i++) {
+ if (lo->ldo_stripe[i] == NULL)
+ continue;
+
+ rc = lod_sub_declare_ref_del(env, lo->ldo_stripe[i],
+ th);
+
+ rc = lod_sub_declare_destroy(env, lo->ldo_stripe[i],
+ th);
+ if (rc != 0)
+ break;
+ }
+ } else {
+ struct lod_obj_stripe_cb_data data = { { 0 } };
+
+ data.locd_declare = true;
+ data.locd_stripe_cb = lod_obj_stripe_destroy_cb;
+ rc = lod_obj_for_each_stripe(env, lo, th, &data);
+ }
+
+ RETURN(rc);
+}
+
+/**
+ * Implementation of dt_object_operations::do_destroy.
+ *
+ * If the object is a striped directory, then the function removes references
+ * from the master object (this is an index) to the stripes and destroys all
+ * the stripes. In all the cases, the function destroys the object itself.
+ *
+ * \see dt_object_operations::do_destroy() in the API description for details.
+ */
+static int lod_destroy(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *th)
+{
+ struct dt_object *next = dt_object_child(dt);
+ struct lod_object *lo = lod_dt_obj(dt);
+ struct lod_thread_info *info = lod_env_info(env);
+ char *stripe_name = info->lti_key;
+ unsigned int i;
+ int rc;
+ ENTRY;
+
+ /* destroy sub-stripe of master object */
+ if (S_ISDIR(dt->do_lu.lo_header->loh_attr)) {
+ rc = next->do_ops->do_index_try(env, next,
+ &dt_directory_features);
+ if (rc != 0)
+ RETURN(rc);
+
+ for (i = 0; i < lo->ldo_dir_stripe_count; i++) {
+ rc = lod_sub_ref_del(env, next, th);
+ if (rc != 0)
+ RETURN(rc);
+
+ snprintf(stripe_name, sizeof(info->lti_key), DFID":%d",
+ PFID(lu_object_fid(&lo->ldo_stripe[i]->do_lu)),
+ i);
+
+ CDEBUG(D_INFO, DFID" delete stripe %s "DFID"\n",
+ PFID(lu_object_fid(&dt->do_lu)), stripe_name,
+ PFID(lu_object_fid(&lo->ldo_stripe[i]->do_lu)));
+
+ rc = lod_sub_delete(env, next,
+ (const struct dt_key *)stripe_name, th);
+ if (rc != 0)
+ RETURN(rc);
+ }
+ }
+
+ rc = lod_sub_destroy(env, next, th);
+ if (rc != 0)
+ RETURN(rc);
+
+ if (OBD_FAIL_CHECK(OBD_FAIL_LFSCK_LOST_MDTOBJ) ||
+ OBD_FAIL_CHECK(OBD_FAIL_LFSCK_LOST_MDTOBJ2))
+ RETURN(0);
+
+ if (!lod_obj_is_striped(dt))
+ RETURN(0);
+
+ /* destroy all striped objects */
+ if (S_ISDIR(dt->do_lu.lo_header->loh_attr)) {
+ for (i = 0; i < lo->ldo_dir_stripe_count; i++) {
+ if (lo->ldo_stripe[i] == NULL)
+ continue;
+ if (!OBD_FAIL_CHECK(OBD_FAIL_LFSCK_LOST_SPEOBJ) ||
+ i == cfs_fail_val) {
+ dt_write_lock(env, lo->ldo_stripe[i],
+ MOR_TGT_CHILD);
+ rc = lod_sub_ref_del(env, lo->ldo_stripe[i],
+ th);
+ dt_write_unlock(env, lo->ldo_stripe[i]);
+ if (rc != 0)
+ break;
+
+ rc = lod_sub_destroy(env, lo->ldo_stripe[i],
+ th);
+ if (rc != 0)
+ break;
+ }
+ }
+ } else {
+ struct lod_obj_stripe_cb_data data = { { 0 } };
+
+ data.locd_declare = false;
+ data.locd_stripe_cb = lod_obj_stripe_destroy_cb;
+ rc = lod_obj_for_each_stripe(env, lo, th, &data);
+ }
+
+ RETURN(rc);
+}
+
+/**
+ * Implementation of dt_object_operations::do_declare_ref_add.
+ *
+ * \see dt_object_operations::do_declare_ref_add() in the API description
+ * for details.
+ */
+static int lod_declare_ref_add(const struct lu_env *env,
+ struct dt_object *dt, struct thandle *th)
+{
+ return lod_sub_declare_ref_add(env, dt_object_child(dt), th);
+}
+
+/**
+ * Implementation of dt_object_operations::do_ref_add.
+ *
+ * \see dt_object_operations::do_ref_add() in the API description for details.
+ */
+static int lod_ref_add(const struct lu_env *env,
+ struct dt_object *dt, struct thandle *th)
+{
+ return lod_sub_ref_add(env, dt_object_child(dt), th);
+}
+
+/**
+ * Implementation of dt_object_operations::do_declare_ref_del.
+ *
+ * \see dt_object_operations::do_declare_ref_del() in the API description
+ * for details.
+ */
+static int lod_declare_ref_del(const struct lu_env *env,
+ struct dt_object *dt, struct thandle *th)
+{
+ return lod_sub_declare_ref_del(env, dt_object_child(dt), th);
+}
+
+/**
+ * Implementation of dt_object_operations::do_ref_del
+ *
+ * \see dt_object_operations::do_ref_del() in the API description for details.
+ */
+static int lod_ref_del(const struct lu_env *env,
+ struct dt_object *dt, struct thandle *th)
+{
+ return lod_sub_ref_del(env, dt_object_child(dt), th);
+}
+
+/**
+ * Implementation of dt_object_operations::do_object_sync.
+ *
+ * \see dt_object_operations::do_object_sync() in the API description
+ * for details.
+ */
+static int lod_object_sync(const struct lu_env *env, struct dt_object *dt,
+ __u64 start, __u64 end)
+{
+ return dt_object_sync(env, dt_object_child(dt), start, end);
+}
+
+/**
+ * Release LDLM locks on the stripes of a striped directory.
+ *
+ * Iterates over all the locks taken on the stripe objects and
+ * cancel them.
+ *
+ * \param[in] env execution environment
+ * \param[in] dt striped object
+ * \param[in] einfo lock description
+ * \param[in] policy data describing requested lock
+ *
+ * \retval 0 on success
+ * \retval negative if failed
+ */
+static int lod_object_unlock_internal(const struct lu_env *env,
+ struct dt_object *dt,
+ struct ldlm_enqueue_info *einfo,
+ union ldlm_policy_data *policy)
+{
+ struct lustre_handle_array *slave_locks = einfo->ei_cbdata;
+ int rc = 0;
+ int i;
+ ENTRY;
+
+ if (slave_locks == NULL)
+ RETURN(0);
+
+ for (i = 1; i < slave_locks->count; i++) {
+ if (lustre_handle_is_used(&slave_locks->handles[i]))
+ ldlm_lock_decref_and_cancel(&slave_locks->handles[i],
+ einfo->ei_mode);
+ }
+
+ RETURN(rc);
+}
+
+/**
+ * Implementation of dt_object_operations::do_object_unlock.
+ *
+ * Used to release LDLM lock(s).
+ *
+ * \see dt_object_operations::do_object_unlock() in the API description
+ * for details.
+ */
+static int lod_object_unlock(const struct lu_env *env, struct dt_object *dt,
+ struct ldlm_enqueue_info *einfo,
+ union ldlm_policy_data *policy)
+{
+ struct lod_object *lo = lod_dt_obj(dt);
+ struct lustre_handle_array *slave_locks = einfo->ei_cbdata;
+ int slave_locks_size;
+ int i;
+ ENTRY;
+
+ if (slave_locks == NULL)
+ RETURN(0);
+
+ LASSERT(S_ISDIR(dt->do_lu.lo_header->loh_attr));
+ LASSERT(lo->ldo_dir_stripe_count > 1);
+ /* Note: for remote lock for single stripe dir, MDT will cancel
+ * the lock by lockh directly */
+ LASSERT(!dt_object_remote(dt_object_child(dt)));
+
+ /* locks were unlocked in MDT layer */
+ for (i = 1; i < slave_locks->count; i++) {
+ LASSERT(!lustre_handle_is_used(&slave_locks->handles[i]));
+ dt_invalidate(env, lo->ldo_stripe[i]);
+ }
+
+ slave_locks_size = sizeof(*slave_locks) + slave_locks->count *
+ sizeof(slave_locks->handles[0]);
+ OBD_FREE(slave_locks, slave_locks_size);
+ einfo->ei_cbdata = NULL;
+
+ RETURN(0);
+}
+
+/**
+ * Implementation of dt_object_operations::do_object_lock.
+ *
+ * Used to get LDLM lock on the non-striped and striped objects.
+ *
+ * \see dt_object_operations::do_object_lock() in the API description
+ * for details.
+ */
+static int lod_object_lock(const struct lu_env *env,
+ struct dt_object *dt,
+ struct lustre_handle *lh,
+ struct ldlm_enqueue_info *einfo,
+ union ldlm_policy_data *policy)
+{
+ struct lod_object *lo = lod_dt_obj(dt);
+ int rc = 0;
+ int i;
+ int slave_locks_size;
+ struct lustre_handle_array *slave_locks = NULL;
+ ENTRY;
+
+ /* remote object lock */
+ if (!einfo->ei_enq_slave) {
+ LASSERT(dt_object_remote(dt));
+ return dt_object_lock(env, dt_object_child(dt), lh, einfo,
+ policy);
+ }
+
+ if (!S_ISDIR(dt->do_lu.lo_header->loh_attr))
+ GOTO(out, rc = -ENOTDIR);
+
+ rc = lod_load_striping(env, lo);
+ if (rc != 0)
+ GOTO(out, rc);
+
+ /* No stripes */
+ if (lo->ldo_dir_stripe_count <= 1) {
+ /*
+ * NB, ei_cbdata stores pointer to slave locks, if no locks
+ * taken, make sure it's set to NULL, otherwise MDT will try to
+ * unlock them.
+ */
+ einfo->ei_cbdata = NULL;
+ GOTO(out, rc = 0);
+ }
+
+ slave_locks_size = sizeof(*slave_locks) + lo->ldo_dir_stripe_count *
+ sizeof(slave_locks->handles[0]);
+ /* Freed in lod_object_unlock */
+ OBD_ALLOC(slave_locks, slave_locks_size);
+ if (slave_locks == NULL)
+ GOTO(out, rc = -ENOMEM);
+ slave_locks->count = lo->ldo_dir_stripe_count;
+
+ /* striped directory lock */
+ for (i = 1; i < lo->ldo_dir_stripe_count; i++) {
+ struct lustre_handle lockh;
+ struct ldlm_res_id *res_id;
+
+ res_id = &lod_env_info(env)->lti_res_id;
+ fid_build_reg_res_name(lu_object_fid(&lo->ldo_stripe[i]->do_lu),
+ res_id);
+ einfo->ei_res_id = res_id;
+
+ LASSERT(lo->ldo_stripe[i] != NULL);
+ if (likely(dt_object_remote(lo->ldo_stripe[i]))) {
+ rc = dt_object_lock(env, lo->ldo_stripe[i], &lockh,
+ einfo, policy);
+ } else {
+ struct ldlm_namespace *ns = einfo->ei_namespace;
+ ldlm_blocking_callback blocking = einfo->ei_cb_local_bl;
+ ldlm_completion_callback completion = einfo->ei_cb_cp;
+ __u64 dlmflags = LDLM_FL_ATOMIC_CB;
+
+ if (einfo->ei_mode == LCK_PW ||
+ einfo->ei_mode == LCK_EX)
+ dlmflags |= LDLM_FL_COS_INCOMPAT;
+
+ /* This only happens if there are mulitple stripes
+ * on the master MDT, i.e. except stripe0, there are
+ * other stripes on the Master MDT as well, Only
+ * happens in the test case right now. */
+ LASSERT(ns != NULL);
+ rc = ldlm_cli_enqueue_local(ns, res_id, LDLM_IBITS,
+ policy, einfo->ei_mode,
+ &dlmflags, blocking,
+ completion, NULL,
+ NULL, 0, LVB_T_NONE,
+ NULL, &lockh);
+ }
+ if (rc != 0)
+ break;
+ slave_locks->handles[i] = lockh;
+ }
+ einfo->ei_cbdata = slave_locks;
+
+ if (rc != 0 && slave_locks != NULL) {
+ lod_object_unlock_internal(env, dt, einfo, policy);
+ OBD_FREE(slave_locks, slave_locks_size);
+ }
+ EXIT;
+out:
+ if (rc != 0)
+ einfo->ei_cbdata = NULL;
+ RETURN(rc);
+}
+
+/**
+ * Implementation of dt_object_operations::do_invalidate.
+ *
+ * \see dt_object_operations::do_invalidate() in the API description for details
+ */
+static int lod_invalidate(const struct lu_env *env, struct dt_object *dt)
+{
+ return dt_invalidate(env, dt_object_child(dt));
+}
+
+static int lod_layout_data_init(struct lod_thread_info *info, __u32 comp_cnt)
+{