}
run_test 5 "Make sure init size work for mirrored layout"
+# LU=10112: disable dom+flr for phase 1
+test_6() {
+ local tf=$DIR/$tfile
+
+ $LFS mirror create -N -E 1M -L mdt -E eof -N -E eof $tf &&
+ error "expect failure to create mirrored file with DoM"
+
+ $LFS mirror create -N -E 1M -E eof -N -E 1M -L mdt -E eof $tf &&
+ error "expect failure to create mirrored file with DoM"
+
+ $LFS setstripe -E 1M -L mdt -E eof $tf
+ $LFS mirror extend -N2 $tf &&
+ error "expect failure to extend mirror with DoM"
+
+ $LFS mirror create -N2 -E 1M -E eof $tf-2
+ $LFS mirror extend -N -f $tf $tf-2 &&
+ error "expect failure to extend mirrored file with DoM extent"
+
+ true
+}
+run_test 6 "DoM and FLR won't co-exist for phase 1"
+
test_21() {
local tf=$DIR/$tfile
local tf2=$DIR/$tfile-2
struct mirror_args *m_next;
};
+static inline int mirror_sanity_check_one(struct llapi_layout *layout)
+{
+ uint64_t start, end;
+ uint64_t pattern;
+ int rc;
+
+ /* LU-10112: do not support dom+flr in phase 1 */
+ rc = llapi_layout_comp_use(layout, LLAPI_LAYOUT_COMP_USE_FIRST);
+ if (rc)
+ return -errno;
+
+ rc = llapi_layout_pattern_get(layout, &pattern);
+ if (rc)
+ return -errno;
+
+ if (pattern == LOV_PATTERN_MDT || pattern == LLAPI_LAYOUT_MDT) {
+ fprintf(stderr, "error: %s: doesn't support dom+flr for now\n",
+ progname);
+ return -ENOTSUP;
+ }
+
+ rc = llapi_layout_comp_use(layout, LLAPI_LAYOUT_COMP_USE_LAST);
+ if (rc)
+ return -errno;
+
+ rc = llapi_layout_comp_extent_get(layout, &start, &end);
+ if (rc)
+ return -errno;
+
+ if (end != LUSTRE_EOF) {
+ fprintf(stderr, "error: %s: mirror layout doesn't reach eof\n",
+ progname);
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
/**
* enum mirror_flags - Flags for extending a mirrored file.
* @NO_VERIFY: Indicates not to verify the mirror(s) from victim file(s)
*
* Return: 0 on success or a negative error code on failure.
*/
-static int mirror_create_sanity_check(struct mirror_args *list)
+static int mirror_create_sanity_check(const char *fname,
+ struct mirror_args *list)
{
int rc = 0;
bool has_m_file = false;
if (list == NULL)
return -EINVAL;
- while (list != NULL) {
- uint64_t start, end;
+ if (fname) {
+ struct llapi_layout *layout;
+
+ layout = llapi_layout_get_by_path(fname, 0);
+ if (!layout) {
+ fprintf(stderr,
+ "error: %s: file '%s' couldn't get layout\n",
+ progname, fname);
+ return -ENODATA;
+ }
+
+ rc = mirror_sanity_check_one(layout);
+ llapi_layout_free(layout);
+
+ if (rc)
+ return rc;
+ }
+ while (list != NULL) {
if (list->m_file != NULL) {
has_m_file = true;
llapi_layout_free(list->m_layout);
}
}
- rc = llapi_layout_comp_use(list->m_layout,
- LLAPI_LAYOUT_COMP_USE_LAST);
- if (rc)
- return -errno;
-
- rc = llapi_layout_comp_extent_get(list->m_layout, &start, &end);
+ rc = mirror_sanity_check_one(list->m_layout);
if (rc)
- return -errno;
-
- if (end != LUSTRE_EOF) {
- fprintf(stderr,
- "error: %s: mirror layout doesn't reach eof\n",
- progname);
- return -EINVAL;
- }
+ return rc;
list = list->m_next;
}
int i = 0;
int rc = 0;
- rc = mirror_create_sanity_check(mirror_list);
+ rc = mirror_create_sanity_check(NULL, mirror_list);
if (rc)
return rc;
{
int rc;
- rc = mirror_create_sanity_check(mirror_list);
+ rc = mirror_create_sanity_check(fname, mirror_list);
if (rc)
return rc;