#define LOV_USES_DEFAULT_STRIPE 1
/* Special values to remove LOV EA from disk */
-#define LOVEA_DELETE_VALUES(size, count, offset) \
- ((size) == 0 && (count) == 0 && (offset) == (typeof(offset))(-1))
+#define LOVEA_DELETE_VALUES(size, count, offset, pool) \
+ ((size) == 0 && (count) == 0 && \
+ (offset) == (typeof(offset))(-1) && (pool) == NULL)
#define LMVEA_DELETE_VALUES(count, offset) \
((count) == 0 && (offset) == (typeof(offset))(-1))
const struct lu_buf *buf);
int lod_initialize_objects(const struct lu_env *env, struct lod_object *mo,
struct lov_ost_data_v1 *objs);
-int lod_store_def_striping(const struct lu_env *env, struct dt_object *dt,
- struct thandle *th);
int lod_verify_striping(struct lod_device *d, const struct lu_buf *buf,
bool is_from_disk);
int lod_generate_and_set_lovea(const struct lu_env *env,
}
/**
- * 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
if (lo->ldo_striping_cached &&
!LOVEA_DELETE_VALUES(lo->ldo_def_stripe_size,
lo->ldo_def_stripenr,
- lo->ldo_def_stripe_offset)) {
+ lo->ldo_def_stripe_offset,
+ lo->ldo_pool)) {
struct lov_user_md_v3 *v3;
/* sigh, lti_ea_store has been used for lmv_buf,
struct lod_object *l = lod_dt_obj(dt);
struct lov_user_md_v1 *lum;
struct lov_user_md_v3 *v3 = NULL;
+ const char *pool_name = NULL;
int rc;
ENTRY;
if (rc)
RETURN(rc);
- if (lum->lmm_magic == LOV_USER_MAGIC_V3)
+ if (lum->lmm_magic == LOV_USER_MAGIC_V3) {
v3 = buf->lb_buf;
+ if (v3->lmm_pool_name[0] != '\0')
+ pool_name = v3->lmm_pool_name;
+ }
/* if { size, offset, count } = { 0, -1, 0 } and no pool
* (i.e. all default values specified) then delete default
(int)lum->lmm_stripe_offset,
v3 ? "from" : "", v3 ? v3->lmm_pool_name : "");
- if (LOVEA_DELETE_VALUES((lum->lmm_stripe_size),
- (lum->lmm_stripe_count),
- (lum->lmm_stripe_offset)) &&
- lum->lmm_magic == LOV_USER_MAGIC_V1) {
+ if (LOVEA_DELETE_VALUES(lum->lmm_stripe_size, lum->lmm_stripe_count,
+ lum->lmm_stripe_offset, pool_name)) {
rc = lod_xattr_del_internal(env, dt, name, th, capa);
if (rc == -ENODATA)
rc = 0;
if (lo->ldo_striping_cached &&
!LOVEA_DELETE_VALUES(lo->ldo_def_stripe_size,
lo->ldo_def_stripenr,
- lo->ldo_def_stripe_offset)) {
+ lo->ldo_def_stripe_offset,
+ lo->ldo_pool)) {
struct lov_user_md_v3 *v3;
/* sigh, lti_ea_store has been used for lmv_buf,
if (lo->ldo_striping_cached &&
!LOVEA_DELETE_VALUES(lo->ldo_def_stripe_size,
lo->ldo_def_stripenr,
- lo->ldo_def_stripe_offset)) {
+ lo->ldo_def_stripe_offset,
+ lo->ldo_pool)) {
struct lov_user_md_v3 *v3 = info->lti_ea_store;
if (info->lti_ea_store_size < sizeof(*v3)) {
/* During creation, there are only a few cases we need do xattr_set to
* create stripes.
* 1. regular file: see comments above.
- * 2. create striped directory with provided stripeEA.
- * 3. create striped directory because inherit default layout from the
- * parent. */
+ * 2. dir: inherit default striping or pool settings from parent.
+ * 3. create striped directory with provided stripeEA.
+ * 4. create striped directory because inherit default layout from the
+ * parent.
+ */
if (spec->no_create ||
(S_ISREG(attr->la_mode) && spec->sp_cr_flags & MDS_OPEN_HAS_EA) ||
S_ISDIR(attr->la_mode)) {
local ost_range="$first_ost $last_ost $ost_step"
local test_path=$POOL_ROOT/$POOL_DIR_NAME
local file_dir=$POOL_ROOT/file_tst
+ local subdir=$test_path/subdir
local rc=0
while : ; do
mkdir -p $test_path
pool_set_dir $POOL $test_path || { rc=$? ; break; }
pool_check_dir $POOL $test_path || { rc=$? ; break; }
+ mkdir -p $subdir
+ pool_check_dir $POOL $subdir || { rc=$? ; break; }
pool_dir_rel_path $POOL $POOL_DIR_NAME $POOL_ROOT \
|| { rc=$? ; break; }
# former test_200e test_200f