/* The flags are for mirrors */
#define LCME_MIRROR_FLAGS (LCME_FL_NOSYNC)
+/* These flags have meaning when set in a default layout and will be inherited
+ * from the default/template layout set on a directory.
+ */
+#define LCME_TEMPLATE_FLAGS (LCME_FL_PREF_RW | LCME_FL_NOSYNC)
+
/* the highest bit in obdo::o_layout_version is used to mark if the file is
* being resynced. */
#define LU_LAYOUT_RESYNC LCME_FL_NEG
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];
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;
+ lod_comp->llc_extent =
+ comp_v1->lcm_entries[i].lcme_extent;
+ /* We only inherit certain flags from the layout */
+ lod_comp->llc_flags =
+ comp_v1->lcm_entries[i].lcme_flags &
+ LCME_TEMPLATE_FLAGS;
}
if (v1->lmm_pattern != LOV_PATTERN_RAID0 &&
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",
+ CDEBUG(D_LAYOUT, "Inherit from default: flags=%#x "
+ "size=%hu nr=%u offset=%u pattern=%#x pool=%s\n",
+ def_comp->llc_flags,
def_comp->llc_stripe_size,
def_comp->llc_stripe_count,
def_comp->llc_stripe_offset,
run_test 0g "lfs mirror create flags support"
test_0h() {
- local tf=$DIR/$tfile
+ local td=$DIR/$tdir
+ local tf=$td/$tfile
+ local ids
+ local i
- $LFS mirror create -N -E 1M -S 1M --flags=prefer -E eof -N2 $tf ||
- error "create mirrored file $tf failed"
+ # create parent directory
+ test_mkdir $td || error "mkdir $td failed"
+
+ $LFS setstripe -N -E 1M -S 1M --flags=prefer -E eof -N2 $td ||
+ error "set default mirrored layout on directory $td failed"
+
+ # verify flags are inherited from the directory
+ touch $tf
verify_comp_attr lcme_flags $tf 0x10001 prefer
verify_comp_attr lcme_flags $tf 0x10002 prefer