}
/**
- * Store default striping.
- *
- * Store default striping for the files in the given directory. The data
- * are stored in the LOD-object representing the directory (ldo_def_* fields).
- * If default striping matches virtual fs-wide default striping, then we
- * store nothing. This mean that the files in the directory will be created
- * with filesystem-wide default striping. The transaction must be started.
- *
- * \param[in] env execution environment for this thread
- * \param[in] dt dt object representing directory in LOD layer
- * \param[in] th transaction handle
- *
- * \retval 0 if stored successfully or no need to store
- * \retval negative error number on failure
- */
-int lod_store_def_striping(const struct lu_env *env, struct dt_object *dt,
- struct thandle *th)
-{
- struct lod_thread_info *info = lod_env_info(env);
- struct lod_object *lo = lod_dt_obj(dt);
- struct dt_object *next = dt_object_child(dt);
- struct lov_user_md_v3 *v3;
- int rc;
- ENTRY;
-
- if (S_ISDIR(dt->do_lu.lo_header->loh_attr))
- RETURN(-ENOTDIR);
- /*
- * store striping defaults into new directory
- * used to implement defaults inheritance
- */
-
- /* probably nothing to inherite */
- if (lo->ldo_striping_cached == 0)
- RETURN(0);
-
- if (LOVEA_DELETE_VALUES(lo->ldo_def_stripe_size, lo->ldo_def_stripenr,
- lo->ldo_def_stripe_offset))
- RETURN(0);
-
- v3 = info->lti_ea_store;
- if (info->lti_ea_store_size < sizeof(*v3)) {
- rc = lod_ea_store_resize(info, sizeof(*v3));
- if (rc != 0)
- RETURN(rc);
- v3 = info->lti_ea_store;
- }
- memset(v3, 0, sizeof(*v3));
- v3->lmm_magic = cpu_to_le32(LOV_USER_MAGIC_V3);
- v3->lmm_stripe_count = cpu_to_le16(lo->ldo_def_stripenr);
- v3->lmm_stripe_offset = cpu_to_le16(lo->ldo_def_stripe_offset);
- v3->lmm_stripe_size = cpu_to_le32(lo->ldo_def_stripe_size);
- if (lo->ldo_pool != NULL) {
- strlcpy(v3->lmm_pool_name, lo->ldo_pool,
- sizeof(v3->lmm_pool_name));
- v3->lmm_pool_name[sizeof(v3->lmm_pool_name) - 1] = '\0';
- }
- info->lti_buf.lb_buf = v3;
- info->lti_buf.lb_len = sizeof(*v3);
- rc = dt_xattr_set(env, next, &info->lti_buf, XATTR_NAME_LOV, 0, th,
- BYPASS_CAPA);
-
- RETURN(rc);
-}
-
-/**
* Verify the target index is present in the current configuration.
*
* \param[in] md LOD device where the target table is stored