# create a mirrored file and extend it
$LFS mirror create -N $tf-1 || error "create mirrored file $tf-1 failed"
$LFS mirror create -N $tf-2 || error "create mirrored file $tf-2 failed"
+ $LFS mirror create -N $tf-3 || error "create mirrored file $tf-3 failed"
- $mirror_cmd -N -S 4M -N -f $tf-2 $tf-1 &> /dev/null &&
- error "setstripe options should not be specified with -f option"
+ $mirror_cmd -N -S 4M -N -f $tf-2 $tf-1 ||
+ error "extend mirror with -f failed"
- $mirror_cmd -N$((mirror_count - 1)) $tf-1 ||
- error "extend mirrored file $tf-1 failed"
- verify_mirror_count $tf-1 $mirror_count
- ids=($($LFS getstripe $tf-1 | awk '/lcme_id/{print $2}' | tr '\n' ' '))
+ $mirror_cmd -N$((mirror_count - 1)) $tf-3 ||
+ error "extend mirrored file $tf-3 failed"
+ verify_mirror_count $tf-3 $mirror_count
+ ids=($($LFS getstripe $tf-3 | awk '/lcme_id/{print $2}' | tr '\n' ' '))
for ((i = 0; i < $mirror_count; i++)); do
- verify_comp_attrs $tf-1 ${ids[$i]}
- verify_comp_extent $tf-1 ${ids[$i]} 0 EOF
+ verify_comp_attrs $tf-3 ${ids[$i]}
+ verify_comp_extent $tf-3 ${ids[$i]} 0 EOF
done
- $mirror_cmd -N $tf-1 &> /dev/null &&
+ $mirror_cmd -N $tf-3 &> /dev/null &&
error "exceeded maximum mirror count $mirror_count" || true
}
run_test 0d "lfs mirror extend with -N option"
}
run_test 5 "Make sure init size work for mirrored layout"
-# LU=10112: disable dom+flr for phase 1
test_6() {
+ (( $MDS1_VERSION >= $(version_code 2.12.58) )) ||
+ skip "MDS version older than 2.12.58"
+
local tf=$DIR/$tfile
- $LFS mirror create -N -E 1M -S 1M -L mdt -E eof -N -E eof $tf &&
- error "expect failure to create mirrored file with DoM"
+ $LFS mirror create -N -E 1M -L mdt -E eof -S 1M -N -E eof $tf ||
+ error "failure to create DoM file with mirror"
- $LFS mirror create -N -E 1M -S 1M -E eof -N -E 1M -L mdt -E eof $tf &&
- error "expect failure to create mirrored file with DoM"
+ $LFS mirror create -N -E 1M -S 1M -E eof -N -E 1M -L mdt -E eof $tf ||
+ error "failure to create mirrored file with DoM"
- $LFS setstripe -E 1M -S 1M -L mdt -E eof $tf
- $LFS mirror extend -N2 $tf &&
- error "expect failure to extend mirror with DoM"
+ $LFS setstripe -E 1M -L mdt -E eof -S 1M $tf ||
+ error "failure to create PFL with DoM file"
+ $LFS mirror extend -N2 $tf ||
+ error "failure to extend mirror with DoM"
- $LFS mirror create -N2 -E 1M -S 1M -E eof $tf-2
- $LFS mirror extend -N -f $tf $tf-2 &&
- error "expect failure to extend mirrored file with DoM extent"
+ $LFS setstripe -E 1M -L mdt -E eof -S 1M $tf-1 ||
+ error "failure to create PFL with DoM file"
+ $LFS mirror create -N2 -E 1M -S 1M -E eof $tf-2 ||
+ error "failure to create mirrored file"
+ $LFS mirror extend -N -f $tf-1 $tf-2 ||
+ error "failure to extend mirrored file with DoM extent"
+}
+run_test 6 "DoM and FLR work together"
- true
+test_7() {
+ local tf=$DIR/$tfile
+
+ # create DoM with setting stripe_size == component size
+ $LFS mirror create -N -E1M -S1M -L mdt -Eeof $tf ||
+ error "failure to create DoM with stripe_size == comp size"
+ rm -f $tf || error "delete $tf"
+
+ # DoM should not inherit previous component stripe_size
+ $LFS mirror create -N -E4M -S2M -Eeof -N -E1M -L mdt -Eeof $tf ||
+ error "DoM component shouldn't inherit previous stripe_size"
}
-run_test 6 "DoM and FLR won't co-exist for phase 1"
+run_test 7 "Create mirror with DoM component"
test_21() {
local tf=$DIR/$tfile
if (inherit) {
f_layout = llapi_layout_get_by_path(name, 0);
if (!f_layout) {
+ rc = -EINVAL;
fprintf(stderr, "%s: cannot get layout\n", progname);
goto out;
}
static int mirror_extend(char *fname, struct mirror_args *mirror_list,
enum mirror_flags mirror_flags)
{
- int rc;
-
- rc = mirror_create_sanity_check(fname, mirror_list, true);
- if (rc)
- return rc;
+ int rc = 0;
while (mirror_list) {
if (mirror_list->m_file) {
errno = EINVAL;
return -1;
}
- if (lsa->lsa_stripe_size != LLAPI_LAYOUT_DEFAULT) {
+ if (lsa->lsa_stripe_size != LLAPI_LAYOUT_DEFAULT &&
+ lsa->lsa_stripe_size != lsa->lsa_comp_end - prev_end) {
fprintf(stderr,
"Option 'stripe-size' can't be specified with Data-on-MDT component: %llu\n",
lsa->lsa_stripe_size);
goto error;
}
lsa.lsa_pattern = LLAPI_LAYOUT_MDT;
+ lsa.lsa_stripe_size = LLAPI_LAYOUT_DEFAULT;
} else if (strcmp(argv[optind - 1], "raid0") != 0) {
result = -EINVAL;
fprintf(stderr,