init_logging
# bug number for skipped test:
-ALWAYS_EXCEPT="$SANITY_PFL_EXCEPT"
+ALWAYS_EXCEPT="$SANITY_PFL_EXCEPT "
# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
+# Skip tests for PPC that fail frequently
+if [[ $(uname -m) = ppc64 ]]; then
+ # bug number: LU-13186 LU-13205 LU-13207 LU-13186
+ ALWAYS_EXCEPT+=" 14 16a 16b 17"
+fi
+
+if [[ "$ost1_FSTYPE" == "zfs" ]]; then
+ # bug #: LU-1941
+ ALWAYS_EXCEPT+="24a"
+fi
build_test_filter
check_and_setup_lustre
-if [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.9.51) ]]; then
+if [[ "$MDS1_VERSION" -lt $(version_code 2.9.51) ]]; then
skip_env "Need MDS version at least 2.9.51"
fi
test_mkdir $DIR/$tdir
+ $LFS setstripe -E -1 -C $LOV_MAX_STRIPE_COUNT $comp_file ||
+ error "Create $comp_file failed"
+
+ local count=$($LFS getstripe -I1 -c $comp_file)
+ [ $count -eq $LOV_MAX_STRIPE_COUNT ] ||
+ error "stripe count of first component is shrinked to $count"
+
+ rm -f $comp_file || error "Delete $comp_file failed"
+
# Create file with 1.1*LOV_MAX_STRIPE_COUNT stripes should succeed
$LFS setstripe -E 1m -C $((LOV_MAX_STRIPE_COUNT / 10)) -E -1 \
-C $LOV_MAX_STRIPE_COUNT $comp_file ||
- error "Create $comp_file failed"
+ error "Create $comp_file failed"
+
+ local count=$($LFS getstripe -I2 -c $comp_file)
+ [ $count -eq $LOV_MAX_STRIPE_COUNT ] ||
+ error "stripe count of second component is shrinked to $count"
rm -f $comp_file || error "Delete $comp_file failed"
- # Create file with 2*LOV_MAX_STRIPE_COUNT stripes should fail
- $LFS setstripe -E 1m -C $LOV_MAX_STRIPE_COUNT -E -1 -C $LOV_MAX_STRIPE_COUNT \
- $comp_file && error "Create $comp_file succeeded"
+ # Create file with 3*LOV_MAX_STRIPE_COUNT stripes should fail
+ $LFS setstripe -E 200G -C $LOV_MAX_STRIPE_COUNT \
+ -E 500G -C $LOV_MAX_STRIPE_COUNT \
+ -E -1 -C $LOV_MAX_STRIPE_COUNT $comp_file &&
+ error "Create $comp_file succeeded"
rm -f $comp_file || error "Delete $comp_file failed"
}
run_test 0b "Verify comp stripe count limits"
+test_0c() {
+ [[ $($LCTL get_param mdc.*.import |
+ grep "connect_flags:.*overstriping") ]] ||
+ skip "server does not support overstriping"
+ [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ skip "skipped for lustre < $SEL_VER"
+
+ large_xattr_enabled || skip_env "no large xattr support"
+
+ local comp_file=$DIR/$tdir/$tfile
+
+ test_mkdir $DIR/$tdir
+
+ $LFS setstripe -E -1 -C $LOV_MAX_STRIPE_COUNT -z 128M $comp_file ||
+ error "Create $comp_file failed"
+
+ local count=$($LFS getstripe -I1 -c $comp_file)
+ [ $count -eq $LOV_MAX_STRIPE_COUNT ] ||
+ error "stripe count is shrinked to $count"
+}
+run_test 0c "Verify SEL comp stripe count limits"
+
+test_0d() {
+ local td=$DIR/$tdir
+ local tf=$td/$tfile
+ local comp_end
+ local stripe_size
+
+ # Create parent directory
+ test_mkdir $td
+
+ # Component end must be a multiple of stripe size
+ # and a multiple of 64KiB to align with the minimum
+ # stripe size value.
+ # Values below 4096 are assumed to be in KiB units.
+ $LFS setstripe -E 127 $tf-1 > /dev/null 2>&1 &&
+ error "creating $tf-1 with '-E 127' should fail"
+
+ $LFS setstripe -E 128 -S 512 $tf-1 > /dev/null 2>&1 &&
+ error "creating $tf-1 with '-E 128 -S 512' should fail"
+
+ $LFS setstripe -E 128 $tf-1 ||
+ error "creating $tf-1 failed"
+
+ yes | dd bs=1K count=129 iflag=fullblock of=$tf-1 &&
+ error "writing to $tf-1 should fail"
+
+ yes | dd bs=1K count=128 iflag=fullblock of=$tf-1 ||
+ error "writing to $tf-1 failed"
+
+ comp_end=$($LFS getstripe -I1 -E $tf-1)
+ stripe_size=$($LFS getstripe -I1 -S $tf-1)
+
+ [[ $comp_end == $((128 * 1024)) ]] ||
+ error "incorrect component end '$comp_end' for $tf-1"
+
+ [[ $stripe_size == $((128 * 1024)) ]] ||
+ error "incorrect stripe size '$stripe_size' for $tf-1"
+
+ rm $tf-1 || error "removing $tf-1 failed"
+
+ # The stripe size must be a multiple of 64KiB.
+ # Values below 4096 are assumed to be in KiB units.
+ $LFS setstripe -E -1 -S 2047 $tf-2 > /dev/null 2>&1 &&
+ error "creating $tf-2 with '-S 2047' should fail"
+
+ $LFS setstripe -E -1 -S 2048 $tf-2 ||
+ error "creating $tf-2 failed"
+
+ stripe_size=$($LFS getstripe -I1 -S $tf-2)
+ [[ $stripe_size == $((2048 * 1024)) ]] ||
+ error "incorrect stripe size '$stripe_size' for $tf-2"
+
+ rm $tf-2 || error "removing $tf-2 failed"
+}
+run_test 0d "Verify comp end and stripe size"
+
test_1a() {
local comp_file=$DIR/$tdir/$tfile
local rw_len=$((3 * 1024 * 1024)) # 3M
}
run_test 1c "Test overstriping w/max stripe count"
-test_2() {
+base_test_2() {
local comp_file=$DIR/$tdir/$tfile
local rw_len=$((5 * 1024 * 1024)) # 5M
+ local params=$1
test_mkdir $DIR/$tdir
rm -f $comp_file
- $LFS setstripe -E 1m -S 1m $comp_file ||
- error "Create $comp_file failed"
+ multiop $comp_file oO_RDWR:O_CREAT:O_LOV_DELAY_CREATE:c ||
+ error "create failed $comp_file"
+
+ $LFS setstripe --component-add $params $comp_file ||
+ error "Add component to $comp_file failed"
check_component_count $comp_file 1
rm -f $comp_file || error "Delete $comp_file failed"
}
-run_test 2 "Add component to existing file"
+
+test_2a() {
+ base_test_2 "-E 1m -S 1m"
+}
+run_test 2a "Add components to existing file"
+
+test_2b () {
+ base_test_2 "-E 1m -L mdt"
+}
+run_test 2b "Add components w/DOM to existing file"
del_comp_and_verify() {
local comp_file=$1
$CHECKSTAT -s $size $comp_file || error "size != $size"
}
-test_3() {
+base_test_3() {
local comp_file=$DIR/$tdir/$tfile
+ local params=$1
test_mkdir $DIR/$tdir
rm -f $comp_file
- $LFS setstripe -E 1M -S 1M -E 64M -c 2 -E -1 -c 3 $comp_file ||
- error "Create $comp_file failed"
+ $LFS setstripe $params $comp_file || error "Create $comp_file failed"
check_component_count $comp_file 3
del_comp_and_verify $comp_file "^init" 1 0
del_comp_and_verify $comp_file "init" 0 0
rm -f $comp_file || error "Delete second $comp_file failed"
+}
+
+test_3a() {
+ base_test_3 "-E 1M -S 1M -E 64M -c 2 -E -1 -c 3"
+}
+run_test 3a "Delete components from existing file"
+test_3b() {
+ base_test_3 "-E 1M -L mdt -E 64M -S 1M -c 2 -E -1 -c 3"
}
-run_test 3 "Delete component from existing file"
+run_test 3b "Delete components w/DOM from existing file"
test_4() {
skip "Not supported in PFL"
}
run_test 10 "Inherit composite template from root"
-test_11() {
+test_11a() {
local comp_file=$DIR/$tdir/$tfile
test_mkdir $DIR/$tdir
rm -f $comp_file
[[ -n $f4 ]] && error "1: 4th component instantiated"
# the first 2 components instantiated
- $TRUNCATE $comp_file $((1024*1024*1+1))
+ # Truncate to exact start of new component - LU-12586
+ $TRUNCATE $comp_file $((1024*1024*1))
f2=$($LFS getstripe -I2 $comp_file | grep "l_fid")
[[ -z $f2 ]] && error "2: 2nd component uninstantiated"
[[ -n $f4 ]] && error "2: 4th component instantiated"
# the first 3 components instantiated
- $TRUNCATE $comp_file $((1024*1024*3))
+ $TRUNCATE $comp_file $((1024*1024*3 - 1))
$TRUNCATE $comp_file $((1024*1024*1+1))
f2=$($LFS getstripe -I2 $comp_file | grep "l_fid")
return 0
}
-run_test 11 "Verify component instantiation with write/truncate"
+run_test 11a "Verify component instantiation with write/truncate"
+
+test_11b() {
+ [ $OSTCOUNT -lt 4 ] && skip "needs >= 4 OSTs"
+
+ local file=$DIR/$tdir/$tfile
+
+ test_mkdir $DIR/$tdir
+ rm -f $file
+
+ $LFS setstripe -E 1m -E 1g -c 4 -E eof $DIR/$tdir ||
+ error "setstripe dir $DIR/$tdir failed"
+ expand_truncate_test $file ||
+ error "expand_truncate_test failed on $file"
+}
+run_test 11b "truncate file set file size correctly"
test_12() {
[ $OSTCOUNT -lt 3 ] && skip "needs >= 3 OSTs"
$LFS setstripe -E 1M -S 1M -E 10M -E eof $parent/f1 || error "create f1"
$LFS setstripe -E 4M -E 20M -E eof $parent/f2 || error "create f2"
test_mkdir $parent/subdir
- $LFS setstripe -E 6M -S 1M -E 30M -E eof $parent/subdir ||
+ $LFS setstripe -E 6M -S 1M -c1 -E 30M -c4 -E eof -c -1 $parent/subdir ||
error "setstripe to subdir"
$LFS setstripe -E 8M -E eof $parent/subdir/f3 || error "create f3"
$LFS setstripe -c 1 $parent/subdir/f4 || error "create f4"
found=$($LFS find $ext_opts ! $cnt_opts $flg_opts $parent | wc -l)
[ $found -eq 2 ] ||
error "start-1M, end+5M, !count+2, flag=init, $found != 2"
+
+ # check last component stripe count
+ if [ $OSTCOUNT -gt 1 ]; then
+ touch $parent/subdir/f5
+ $TRUNCATE $parent/subdir/f5 $((32*1024*1024))
+ found=$($LFS find $parent/subdir -c $OSTCOUNT)
+ [[ "$found" == "$parent/subdir/f5" ]] ||
+ error "got '$found' with stripe_count=$OSTCOUNT, not f5"
+ fi
}
run_test 15 "Verify component options for lfs find"
}
run_test 16b "Verify setstripe/getstripe with YAML config file + overstriping"
+test_16c() {
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+
+ local file=$DIR/$tdir/$tfile
+ local dir=$DIR/$tdir/dir
+ local temp=$DIR/$tdir/template
+ rm -rf $DIR/$tdir
+ test_mkdir $DIR/$tdir
+
+ #####################################################################
+ # 1. SEL file
+ # set stripe for source file
+ $LFS setstripe -E256M -S 1M -c2 -o0,1 -z 64M -E-1 -o1,0 -z 128M \
+ $file || error "Create $file failed"
+
+ echo "1. SEL file"
+ verify_yaml_layout $file $file.copy $temp "1. PFL file"
+
+ #####################################################################
+ # 2. SEL dir
+ # set stripe for source dir
+ test_mkdir $dir
+ $LFS setstripe -E256M -S 1M -c2 -z 64M -E-1 -z 128M \
+ $dir || error "setstripe $dir failed"
+
+ test_mkdir $dir.copy
+ echo "2. SEL template on dir"
+ verify_yaml_layout $dir $dir.copy $temp.dir "2. PFL dir"
+}
+run_test 16c "Verify setstripe/getstripe for SEL layout with YAML config file"
+
test_17() {
[ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
local file=$DIR/$tdir/$tfile
flg_opts="--comp-flags extension"
found=$($LFS find --comp-start 128M -E EOF $flg_opts $comp_file | wc -l)
- [ $found -eq 1 ] || error "Write: Second component not found"
+ [ $found -eq 1 ] || error "Write: second component not found"
+
+ found=$($LFS find -z 64M $comp_file | wc -l)
+ [ $found -eq 1 ] || error "component not found by ext size"
+
+ found=$($LFS find --extension-size +63M $comp_file | wc -l)
+ [ $found -eq 1 ] || error "component not found by +ext size"
+
+ found=$($LFS find --ext-size -65M $comp_file | wc -l)
+ [ $found -eq 1 ] || error "component not found by -ext size"
+
+ found=$($LFS find -z 65M $comp_file | wc -l)
+ [ $found -eq 0 ] || error "component found by wrong ext size"
+
+ found=$($LFS find -z +65M $comp_file | wc -l)
+ [ $found -eq 0 ] || error "component found by wrong +ext size"
+
+ found=$($LFS find -z -63M $comp_file | wc -l)
+ [ $found -eq 0 ] || error "component found by wrong -ext size"
+
+ found=$($LFS find ! -z 64M $comp_file | wc -l)
+ [ $found -eq 0 ] || error "component found by negation of ext size"
+
+ found=$($LFS find ! -z +63M $comp_file | wc -l)
+ [ $found -eq 0 ] || error "component found by negation of +ext size"
+
+ found=$($LFS find ! -z -65M $comp_file | wc -l)
+ [ $found -eq 0 ] || error "component found by negation of -ext size"
+
+ found=$($LFS find ! -z 65M $comp_file | wc -l)
+ [ $found -eq 1 ] ||
+ error "component not found by negation of wrong ext size"
+
+ found=$($LFS find ! -z +65M $comp_file | wc -l)
+ [ $found -eq 1 ] ||
+ error "component not found by negation of wrong +ext size"
+
+ found=$($LFS find ! -z -63M $comp_file | wc -l)
+ [ $found -eq 1 ] ||
+ error "component not found by negation of wrong -ext size"
+
+ found=$($LFS find -S +1M $comp_file | wc -l)
+ [ $found -eq 0 ] || error "component found by wrong +stripe size"
+
+ found=$($LFS find -c 1 $comp_file | wc -l)
+ [ $found -eq 1 ] || error "component not found by stripe count"
small_write $comp_file $rw_len || error "Verify RW failed"
# Self-extending PFL tests
test_19a() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
test19_io_base $DIR/$tdir/$tfile
# Same as 19a, but with default layout set on directory rather than on file
test_19b() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
+ local comp_dir=$DIR/$tdir/$tdir
local flg_opts=""
local found=""
$LFS setstripe --ext-size 64M -c 1 -E -1 $DIR/$tdir ||
error "Setstripe on $DIR/$tdir failed"
+ # check inheritance for a sub-dir and a file
+ test_mkdir $comp_dir
+ found=$($LFS find --comp-start 0 -E 64M $comp_dir | wc -l)
+ [ $found -eq 1 ] || error "Dir Inheritance: wrong first component size"
+
+ flg_opts="--comp-flags extension"
+ found=$($LFS find --comp-start 64M -E EOF $flg_opts $comp_dir | wc -l)
+ [ $found -eq 1 ] || error "Dir Inheritance: Second component not found"
+
touch $comp_file
flg_opts="--comp-flags init"
found=$($LFS find --comp-start 0 -E 64M $flg_opts $comp_file | wc -l)
- [ $found -eq 1 ] || error "Inheritance: wrong first component size"
+ [ $found -eq 1 ] || error "File Inheritance: wrong first component size"
flg_opts="--comp-flags extension"
found=$($LFS find --comp-start 64M -E EOF $flg_opts $comp_file | wc -l)
- [ $found -eq 1 ] || error "Inheritance: Second component not found"
+ [ $found -eq 1 ] || error "File Inheritance: Second component not found"
test19_io_base $comp_file 1
}
# Test behavior when seeking deep in a file
test_19c() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
run_test 19c "Test self-extending layout seeking behavior"
test_19d() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
}
test_19e() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
}
run_test 19e "Replay of layout instantiation & extension"
+test_19f() {
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
+ skip "skipped for lustre < $SEL_VER"
+
+ local comp_file=$DIR/$tdir/$tfile
+ local flg_opts=""
+ local found=""
+
+ test_mkdir -p $DIR/$tdir
+
+ $LFS setstripe -E 256M --comp-flags extension -E -1 $comp_file
+
+ [ $? != 0 ] || error "should not be able to manually set extension flag"
+
+}
+run_test 19f "Rejection of invalid layouts"
+
+test_19g() {
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
+ skip "skipped for lustre < $SEL_VER"
+
+ local file1=$DIR/${tfile}-1
+ local file2=$DIR/${tfile}-2
+
+ test_mkdir -p $DIR/$tdir
+ multiop $file1 oO_RDWR:O_CREAT:O_LOV_DELAY_CREATE:c ||
+ error "create failed $file1"
+ multiop $file2 oO_RDWR:O_CREAT:O_LOV_DELAY_CREATE:c ||
+ error "create failed $file2"
+
+ $LFS setstripe --component-add -E 1G -c 1 $file1 ||
+ error "comp-add [0,1G] failed $file1"
+ $LFS setstripe --component-add -E 512M -z 128M $file1 &&
+ error "comp-add [1G,1G],SEL[1G,512M] succeded $file1"
+ $LFS setstripe --component-add -E 10G -z 128M $file1 ||
+ error "comp-add [1G,1G],SEL[1G,10G] failed $file1"
+ $LFS setstripe --component-add -E -1 $file1 ||
+ error "comp-add [10G,-1] failed $file1"
+
+ $LFS setstripe --component-add -E 1G -z 32M -c 1 $file2 &&
+ error "comp-add with smal ext size succeeded $file1"
+ $LFS setstripe --component-add -E 1G -z 100M -c 1 $file2 &&
+ error "comp-add with not aligned ext size succeeded $file1"
+ $LFS setstripe --component-add -E 1G -z 128M -c 1 $file2 ||
+ error "comp-add [0,128M],SEL[128M,1G] failed $file1"
+ $LFS setstripe --component-add -E 10G $file2 ||
+ error "comp-add [1G,10G] failed $file1"
+ $LFS setstripe --component-add -E -1 -z 128M -c 1 $file2 ||
+ error "comp-add [10G,10G],SEL[10G,-1] failed $file1"
+ $LFS setstripe --component-add -E -1 -z 128M -c 1 $file2 &&
+ error "repeated comp-add [10G,10G],SEL[10G,-1] succeeded $file1"
+
+ $LFS getstripe $file1
+ flg_opts="--comp-flags init"
+ found=$($LFS find --comp-start 0 -E 1G $flg_opts $file1 | wc -l)
+ [ $found -eq 1 ] || error "First component not found $file1"
+
+ flg_opts="--comp-flags ^init"
+ found=$($LFS find --comp-start 1G -E 1G $flg_opts $file1 | wc -l)
+ [ $found -eq 1 ] || error "Second component not found $file1"
+
+ flg_opts="--comp-flags ^init,extension"
+ found=$($LFS find --comp-start 1G -E 10G $flg_opts $file1 | wc -l)
+ [ $found -eq 1 ] || error "Third component not found $file1"
+
+ flg_opts="--comp-flags ^init"
+ found=$($LFS find --comp-start 10G -E EOF $flg_opts $file1 | wc -l)
+ [ $found -eq 1 ] || error "Fourth component not found $file1"
+
+ $LFS getstripe $file2
+ flg_opts="--comp-flags init"
+ found=$($LFS find --comp-start 0 -E 128M $flg_opts $file2 | wc -l)
+ [ $found -eq 1 ] || error "First component not found $file2"
+
+ flg_opts="--comp-flags extension"
+ found=$($LFS find --comp-start 128M -E 1G $flg_opts $file2 | wc -l)
+ [ $found -eq 1 ] || error "Second component not found $file2"
+
+ flg_opts="--comp-flags ^init"
+ found=$($LFS find --comp-start 1G -E 10G $flg_opts $file2 | wc -l)
+ [ $found -eq 1 ] || error "Third component not found $file2"
+
+ flg_opts="--comp-flags ^init"
+ found=$($LFS find --comp-start 10G -E 10G $flg_opts $file2 | wc -l)
+ [ $found -eq 1 ] || error "Fourth component not found $file2"
+
+ flg_opts="--comp-flags ^init,extension"
+ found=$($LFS find --comp-start 10G -E EOF $flg_opts $file2 | wc -l)
+ [ $found -eq 1 ] || error "Fifth component not found $file2"
+}
+run_test 19g "component-add behaviour"
+
# Test out of space behavior
test_20a() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
wait_mds_ost_sync
# First component is on OST0
- $LFS setstripe -E 256M -i 0 -z 64M -E -1 -z 1G $comp_file ||
+ $LFS setstripe -E 256M -i 0 -z 64M -E -1 -z 128M $comp_file ||
error "Create $comp_file failed"
# write past end of first component, so it is extended
$LFS getstripe $comp_file
flg_opts="--comp-flags init"
- found=$($LFS find --comp-start 128M -E 1152M $flg_opts $comp_file | \
+ found=$($LFS find --comp-start 128M -E 256M $flg_opts $comp_file | \
wc -l)
[ $found -eq 1 ] || error "Write: third component not found"
flg_opts="--comp-flags extension"
- found=$($LFS find --comp-start 1152M -E EOF $flg_opts $comp_file |wc -l)
+ found=$($LFS find --comp-start 256M -E EOF $flg_opts $comp_file |wc -l)
[ $found -eq 1 ] || error "Write: fourth extension component not found"
sel_layout_sanity $comp_file 3
run_test 20a "Test out of space, spillover to defined component"
test_20b() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
# normal component to 10M, extendable component to 1G
# further extendable to EOF
- $LFS setstripe -E 10M -E 1G -p $TESTNAME -z 64M -E -1 -p "" -z 512M \
+ $LFS setstripe -E 10M -E 1G -p $TESTNAME -z 64M -E -1 -p "" -z 128M \
$comp_file || error "Create $comp_file failed"
replay_barrier $SINGLEMDS
[ $found -eq 0 ] || error "Write: zero length component still present"
flg_opts="--comp-flags init"
- found=$($LFS find --comp-start 10M -E 522M $flg_opts $comp_file | wc -l)
+ found=$($LFS find --comp-start 10M -E 138M $flg_opts $comp_file | wc -l)
[ $found -eq 1 ] || error "Write: second component not found"
flg_opts="--comp-flags extension"
- found=$($LFS find --comp-start 522M -E EOF $flg_opts $comp_file | wc -l)
+ found=$($LFS find --comp-start 138M -E EOF $flg_opts $comp_file | wc -l)
[ $found -eq 1 ] || error "Write: third component not found"
fail $SINGLEMDS
[ $found -eq 0 ] || error "Failover: 0-length component still present"
flg_opts="--comp-flags init"
- found=$($LFS find --comp-start 10M -E 522M $flg_opts $comp_file | wc -l)
+ found=$($LFS find --comp-start 10M -E 138M $flg_opts $comp_file | wc -l)
[ $found -eq 1 ] || error "Failover: second component not found"
flg_opts="--comp-flags extension"
- found=$($LFS find --comp-start 522M -E EOF $flg_opts $comp_file | wc -l)
+ found=$($LFS find --comp-start 138M -E EOF $flg_opts $comp_file | wc -l)
[ $found -eq 1 ] || error "Failover: third component not found"
sel_layout_sanity $comp_file 3
run_test 20b "Remove component without instantiation when there is no space"
test_20c() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
run_test 20c "Test inability to stripe new extension component"
test_20d() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
run_test 20d "Low on space + 0-length comp: force extension"
test_20e() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
# Simple DoM interaction test
test_21a() {
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
# DoM + extension + removal
test_21b() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
test_mkdir -p $DIR/$tdir
# DoM, extendable component, further extendable component
- $LFS setstripe -E 1M -L mdt -E 256M -i 0 -z 64M -E -1 -z 1G \
+ $LFS setstripe -E 1M -L mdt -E 256M -i 0 -z 64M -E -1 -z 128M \
$comp_file || error "Create $comp_file failed"
found=$($LFS find --comp-start 1M -E 1M $flg_opts $comp_file | wc -l)
[ $found -eq 0 ] || error "Write: Zero length component still present"
flg_opts="--comp-flags init"
- found=$($LFS find --comp-start 1M -E 1025M $flg_opts $comp_file | wc -l)
+ found=$($LFS find --comp-start 1M -E 129M $flg_opts $comp_file | wc -l)
[ $found -eq 1 ] || error "Write: extended component not found"
flg_opts="--comp-flags extension"
- found=$($LFS find --comp-start 1025M -E EOF $flg_opts $comp_file |wc -l)
+ found=$($LFS find --comp-start 129M -E EOF $flg_opts $comp_file |wc -l)
[ $found -eq 1 ] || error "Write: extension component not found"
sel_layout_sanity $comp_file 3
}
run_test 21b "DoM followed by extendable component with removal"
+# Test of repeat component behavior with OOS/degraded OST
+test_22a() {
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
+ skip "skipped for lustre < $SEL_VER"
+
+ local comp_file=$DIR/$tdir/$tfile
+ local flg_opts=""
+ local found=""
+
+ test_mkdir -p $DIR/$tdir
+
+ $LFS setstripe -E -1 -c 1 -z 128M $comp_file ||
+ error "Create $comp_file failed"
+
+ local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
+ local ost_name=$(ostname_from_index $ost_idx1)
+
+ # write past end of first component, so it is extended
+ dd if=/dev/zero of=$comp_file bs=1M count=1 seek=130 ||
+ error "dd to extend failed"
+
+ flg_opts="--comp-flags extension"
+ found=$($LFS find --comp-start 256M -E EOF $flg_opts $comp_file | wc -l)
+ [ $found -eq 1 ] || error "Write: second component not found"
+
+ # degrade OST for component 1
+ do_facet ost$((ost_idx1+1)) $LCTL set_param -n \
+ obdfilter.$ost_name.degraded=1
+ # sleep to guarantee we see the degradation
+ sleep_maxage
+
+ # un-degrade on exit
+ stack_trap "do_facet ost$((ost_idx1+1)) $LCTL set_param -n \
+ obdfilter.$ost_name.degraded=0; sleep_maxage" EXIT
+
+ replay_barrier $SINGLEMDS
+
+ # seek past the end of current comp & write, should cause a new comp
+ # to be created (ie repeat previous comp)
+ dd if=/dev/zero of=$comp_file bs=1M count=1 seek=300 ||
+ error "dd to repeat failed"
+
+ local ost_idx2=$($LFS getstripe -I2 -i $comp_file)
+
+ [ $ost_idx1 -eq $ost_idx2 ] && error "$ost_idx1 == $ost_idx2"
+
+ flg_opts="--comp-flags init"
+ found=$($LFS find --comp-start 256M $flg_opts $comp_file | wc -l)
+ [ $found -eq 1 ] || error "Write: second component not found"
+
+ flg_opts="--comp-flags extension"
+ found=$($LFS find --comp-start 384M -E EOF $flg_opts $comp_file | wc -l)
+ [ $found -eq 1 ] || error "Write: extension component not found"
+
+ fail $SINGLEMDS
+
+ local ost_idx2_2=$($LFS getstripe -I2 -i $comp_file)
+ [ $ost_idx2_2 -ne $ost_idx2 ] && error "$ost_idx2_2 != $ost_idx2"
+
+ flg_opts="--comp-flags init"
+ found=$($LFS find --comp-start 256M $flg_opts $comp_file | wc -l)
+ [ $found -eq 1 ] || error "Failover: second component not found"
+
+ flg_opts="--comp-flags extension"
+ found=$($LFS find --comp-start 384M -E EOF $flg_opts $comp_file | wc -l)
+ [ $found -eq 1 ] || error "Failover: extension component not found"
+
+ sel_layout_sanity $comp_file 3
+}
+run_test 22a "Test repeat component behavior with degraded OST"
+
+# Test repeat behavior with low space
+test_22b() {
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
+ skip "skipped for lustre < $SEL_VER"
+
+ local comp_file=$DIR/$tdir/$tfile
+ local flg_opts=""
+ local found=""
+
+ test_mkdir -p $DIR/$tdir
+
+ # without this, a previous delete can finish after we check free space
+ wait_delete_completed
+ wait_mds_ost_sync
+
+ $LFS setstripe -E -1 -c 1 -z 128M \
+ $comp_file || error "Create $comp_file failed"
+
+ # write past end of first component, so it is extended
+ dd if=/dev/zero of=$comp_file bs=1M count=1 seek=130 ||
+ error "dd to extend failed"
+
+ flg_opts="--comp-flags extension"
+ found=$($LFS find --comp-start 256M -E EOF $flg_opts $comp_file | wc -l)
+ [ $found -eq 1 ] || error "Write: Second component not found"
+
+ # set our OST low on space
+ local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
+ local wms=$(ost_watermarks_set_low_space $ost_idx1 | grep "watermarks")
+
+ stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx1 $wms" EXIT
+
+ # Write past end of current space, fail to extend, causing repeat
+ dd if=/dev/zero of=$comp_file bs=1M count=1 seek=300 ||
+ error "dd to repeat failed"
+
+ $LFS getstripe $comp_file
+
+ local ost_idx2=$($LFS getstripe -I2 -i $comp_file)
+
+ [ $ost_idx1 -eq $ost_idx2 ] && error "$ost_idx1 == $ost_idx2"
+
+ flg_opts="--comp-flags init"
+ found=$($LFS find --comp-start 256M $flg_opts $comp_file | wc -l)
+ [ $found -eq 1 ] || error "Write: Second component not found"
+
+ flg_opts="--comp-flags extension"
+ found=$($LFS find --comp-start 384M -E EOF $flg_opts $comp_file | wc -l)
+ [ $found -eq 1 ] || error "Write: Extension component not found"
+
+ sel_layout_sanity $comp_file 3
+}
+run_test 22b "Test simple 'out of space' condition with repeat"
+
+# This tests both "repeat" and "extend in place when repeat fails" aspects
+# of repeating components
+test_22c() {
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
+ skip "skipped for lustre < $SEL_VER"
+
+ local comp_file=$DIR/$tdir/$tfile
+ local flg_opts=""
+ local found=""
+
+ test_mkdir -p $DIR/$tdir
+
+ # pool is used to limit available OSTs to 0 and 1, so we can set all
+ # available OSTs out of space
+ pool_add $TESTNAME || error "Pool creation failed"
+ pool_add_targets $TESTNAME 0 1 || error "Pool add targets failed"
+
+ # without this, a previous delete can finish after we check free space
+ wait_delete_completed
+ wait_mds_ost_sync
+
+ $LFS setstripe -E -1 -z 64M -c 1 -p "$TESTNAME" $comp_file || \
+ error "Create $comp_file failed"
+
+ # write past end of first component, so it is extended
+ dd if=/dev/zero of=$comp_file bs=1M count=1 seek=80 conv=notrunc ||
+ error "dd to extend failed"
+
+ $LFS getstripe $comp_file
+
+ flg_opts="--comp-flags extension"
+ found=$($LFS find --comp-start 128M -E EOF $flg_opts $comp_file | wc -l)
+ [ $found -eq 1 ] || error "Write: second component not found"
+
+ # set our OST out of space
+ local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
+ local wms=$(ost_watermarks_set_enospc $tfile $ost_idx1 |
+ grep "watermarks")
+ stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx1 $wms" EXIT
+
+ # This should create a repeat component on a new OST
+ dd if=/dev/zero of=$comp_file bs=1M count=1 seek=180 conv=notrunc ||
+ error "dd to repeat failed"
+
+ $LFS getstripe $comp_file
+
+ local comp_cnt=$($LFS getstripe --component-count $comp_file)
+ [ $comp_cnt -ne 3 ] && error "component count: $comp_cnt, should be 3"
+
+ # New second component should be on a different OST
+ local ost_idx2=$($LFS getstripe --comp-start=128m \
+ --comp-end=192m --comp-flags=init -i $comp_file)
+
+ [ $ost_idx1 -eq $ost_idx2 ] && error "2nd comp: same OST $ost_idx1"
+
+ local wms2=$(ost_watermarks_set_enospc $tfile $ost_idx2 |
+ grep "watermarks")
+ stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx2 $wms2" EXIT
+
+ # now that the second OST is out of space (as is the first OST), we
+ # attempt to extend. This should result in an extension of the
+ # existing component, rather than a new component.
+ dd if=/dev/zero of=$comp_file bs=1M count=1 seek=240 conv=notrunc ||
+ error "dd for forced extension failed"
+
+ $LFS getstripe $comp_file
+
+ # clear out of space on first OST
+ ost_watermarks_clear_enospc $tfile $ost_idx1 $wms
+
+ # finally, now that the first OST has space again, we attempt to
+ # extend one last time. This should create a new component on the
+ # first OST
+ dd if=/dev/zero of=$comp_file bs=1M count=1 seek=300 conv=notrunc ||
+ error "dd for repeat on first OST failed"
+
+ $LFS getstripe $comp_file
+
+ flg_opts="--comp-flags init"
+ found=$($LFS find --comp-start 128M $flg_opts $comp_file | wc -l)
+ [ $found -eq 1 ] || error "Write: second component not found"
+
+ flg_opts="--comp-flags init"
+ found=$($LFS find --comp-start 256M $flg_opts $comp_file | wc -l)
+ [ $found -eq 1 ] || error "Write: third component not found"
+
+ flg_opts="--comp-flags extension"
+ found=$($LFS find --comp-start 320M -E EOF $flg_opts $comp_file | wc -l)
+ [ $found -eq 1 ] || error "Write: extension component not found"
+
+ sel_layout_sanity $comp_file 4
+}
+run_test 22c "Test repeat with out of space on > 1 OST"
+
+test_22d_post_check() {
+ local comp_file=$1
+ local name=$2
+ local flg_opts="--comp-flags init"
+ local found=$($LFS find --comp-start 0M -E 128M $flg_opts $comp_file |
+ wc -l)
+ [ $found -eq 1 ] || {
+ $LFS getstripe $comp_file
+ error "$name: second component not found"
+ }
+
+ flg_opts="--comp-flags extension"
+ found=$($LFS find --comp-start 128M -E EOF $flg_opts $comp_file | wc -l)
+ [ $found -eq 1 ] || error "$name: third extension component not found"
+
+ sel_layout_sanity $comp_file 2
+}
+
+test_22d_pre() {
+ local comp_file=$1
+ local wms="$2"
+ local RC
+
+ # write past end of first component
+ dd if=/dev/zero of=$comp_file bs=1M count=1 seek=70
+ RC=$?
+
+ ost_watermarks_clear_enospc $tfile 0 $wms
+ [ $RC -eq 0 ] || error "dd to force extend failed"
+
+ test_22d_post_check $comp_file "Write"
+}
+
+test_22d() {
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
+ skip "skipped for lustre < $SEL_VER"
+
+ local comp_file=$DIR/$tdir/$tfile
+ local flg_opts=""
+ local found=""
+
+ test_mkdir -p $DIR/$tdir
+
+ # without this, a previous delete can finish after we check free space
+ wait_delete_completed
+ wait_mds_ost_sync
+
+ # Pool allows us to force use of only certain OSTs
+ pool_add $TESTNAME || error "Pool creation failed"
+ pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
+
+ # 1. Fail to extend due to OOS, try to repeat within the same pool,
+ # fail to stripe (again OOS) the 0-length component, remove the
+ # repeated one, force the extension on the original one.
+ $LFS setstripe -E -1 -p $TESTNAME -z 64M $comp_file ||
+ error "Create $comp_file failed"
+
+ replay_barrier $SINGLEMDS
+
+ # set our OST out of space
+ local wms=$(ost_watermarks_set_enospc $tfile 0 | grep "watermarks")
+
+ test_22d_pre $comp_file "$wms"
+ fail $SINGLEMDS
+ test_22d_post_check $comp_file "Failover"
+
+ # 2. repeat with low on space: 0-length repeated component will be
+ # striped, but still fails to be extended; otherwise the same as (1).
+ rm -f $comp_file
+ $LFS setstripe -E -1 -p $TESTNAME -z 64M $comp_file ||
+ error "Create $comp_file failed"
+
+ replay_barrier $SINGLEMDS
+
+ # set our OST low on space
+ local wms=$(ost_watermarks_set_low_space 0 | grep "watermarks")
+
+ test_22d_pre $comp_file "$wms"
+ fail $SINGLEMDS
+ test_22d_post_check $comp_file "Failover"
+}
+run_test 22d "out of/low on space + failed to repeat + forced extension"
+
test_23a() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
run_test 23a "Append: remove EXT comp"
test_23b() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
run_test 23b "Append with 0-length comp: remove EXT comp"
test_23c() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
run_test 23c "Append with low on space + 0-length comp: force extension"
test_23d() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
run_test 23d "Append with 0-length comp + next real comp: remove EXT comp"
test_23e() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
}
run_test 23e "Append with next real comp: spillover and backward extension"
+test_23f() {
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
+ skip "skipped for lustre < $SEL_VER"
+
+ local comp_file=$DIR/$tdir/$tfile
+ test_mkdir -p $DIR/$tdir
+
+ $LFS setstripe -z 64M -c 1 -E -1 $comp_file ||
+ error "Create $comp_file failed"
+
+ local ost_idx=$($LFS getstripe -I1 -i $comp_file)
+ local wms=$(ost_watermarks_set_low_space $ost_idx | grep "watermarks")
+
+ dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file
+ RC=$?
+
+ ost_watermarks_clear_enospc $tfile $ost_idx $wms
+ [ $RC -eq 0 ] || error "dd append failed"
+
+ local flg_opts="--comp-start 64M -E EOF --comp-flags init"
+ local found=$($LFS find $flg_opts $comp_file | wc -l)
+ [ $found -eq 1 ] || error "Append: component (64M-EOF) not found"
+
+ ost_idx=$($LFS getstripe -I2 -i $comp_file)
+ [ "$ost_idx" != "" ] && error "Append: extension component still exists"
+
+ sel_layout_sanity $comp_file 2
+}
+run_test 23f "Append with low on space: repeat and remove EXT comp"
+
+OLDIFS="$IFS"
+cleanup_24() {
+ trap 0
+ IFS="$OLDIFS"
+}
+
+test_24a() {
+ [ "$OSTCOUNT" -lt "3" ] && skip_env "needs >= 3 OSTs"
+
+ trap cleanup_24 EXIT RETURN
+
+ local file=$DIR/$tfile
+
+ $LFS setstripe -E 1m -c1 -o0 -E eof -c2 -o1,2 $file ||
+ error "setstripe on $file"
+
+ dd if=/dev/zero of=$file bs=1M count=3 || error "dd failed for $file"
+ sync
+
+ filefrag -ves $file || error "filefrag $file failed"
+ filefrag_op=$(filefrag -ve -k $file |
+ sed -n '/ext:/,/found/{/ext:/d; /found/d; p}')
+
+#Filesystem type is: bd00bd0
+#File size of /mnt/lustre/f24a.sanity-pfl is 3145728 (3072 blocks of 1024 bytes)
+# ext: device_logical: physical_offset: length: dev: flags:
+# 0: 0.. 1023: 1572864.. 1573887: 1024: 0000: net
+# 1: 0.. 1023: 1572864.. 1573887: 1024: 0002: net
+# 2: 1024.. 2047: 1573888.. 1574911: 1024: 0001: last,net
+#/mnt/lustre/f24a.sanity-pfl: 3 extents found
+
+ last_lun=$(echo $filefrag_op | cut -d: -f5)
+
+ IFS=$'\n'
+ tot_len=0
+ num_luns=1
+ for line in $filefrag_op; do
+ frag_lun=$(echo $line | cut -d: -f5)
+ ext_len=$(echo $line | cut -d: -f4)
+ if [[ "$frag_lun" != "$last_lun" ]]; then
+ if (( tot_len != 1024 )); then
+ cleanup_24
+ error "$file: OST$last_lun $tot_len != 1024"
+ else
+ (( num_luns += 1 ))
+ tot_len=0
+ fi
+ fi
+ (( tot_len += ext_len ))
+ last_lun=$frag_lun
+ done
+ if (( num_luns != 3 || tot_len != 1024 )); then
+ cleanup_24
+ error "$file: $num_luns != 3, $tot_len != 1024 on OST$last_lun"
+ fi
+
+ echo "FIEMAP on $file succeeded"
+}
+run_test 24a "FIEMAP upon PFL file"
+
+test_25() {
+ local pfl_f=$DIR/$tdir/"$tfile"_pfl
+ local dom_f=$DIR/$tdir/"$tfile"_dom
+ local common_f=$DIR/$tdir/"$tfile"_common
+ local stripe_count
+ local stripe_size
+
+ mkdir -p $DIR/$tdir || error "mkdir $DIR/$tdir failed"
+ $LFS setstripe -E 10M -S 64k -c -1 -E 20M -S 1M -E -1 -S 2M -c 1 \
+ $pfl_f || error "setstripe $pfl_f failed"
+ $LFS setstripe -E 256k -L mdt -E -1 -S 1M $dom_f ||
+ error "setstripe $dom_f failed"
+ $LFS setstripe -S 512K -c -1 $common_f ||
+ error "setstripe $common_f failed"
+
+ #verify lov_getstripe_old with PFL file
+ stripe_count=$(lov_getstripe_old $pfl_f |
+ awk '/stripe_count/ { print $2 }')
+ stripe_size=$(lov_getstripe_old $pfl_f |
+ awk '/stripe_size/ { print $2 }')
+ [ $stripe_count -eq 1 ] ||
+ error "stripe_count $stripe_count !=1 for $pfl_f"
+ [ $stripe_size -eq 2097152 ] ||
+ error "stripe_size $stripe_size != 2097152 for $pfl_f"
+
+ #verify lov_getstripe_old with DoM file
+ stripe_count=$(lov_getstripe_old $dom_f |
+ awk '/stripe_count/ { print $2 }')
+ stripe_size=$(lov_getstripe_old $dom_f |
+ awk '/stripe_size/ { print $2 }')
+ [ $stripe_count -eq 1 ] ||
+ error "stripe_count $stripe_count !=1 for $dom_f"
+ [ $stripe_size -eq 1048576 ] ||
+ error "stripe_size $stripe_size != 1048576 for $dom_f"
+
+ #verify lov_getstripe_old with common file
+ stripe_count=$(lov_getstripe_old $common_f |
+ awk '/stripe_count/ { print $2 }')
+ stripe_size=$(lov_getstripe_old $common_f |
+ awk '/stripe_size/ { print $2 }')
+ [ $stripe_count -eq $OSTCOUNT ] ||
+ error "stripe_count $stripe_count !=$OSTCOUNT for $common_f"
+ [ $stripe_size -eq 524288 ] ||
+ error "stripe_size $stripe_size != 524288 for $common_f"
+}
+run_test 25 "Verify old lov stripe API with PFL files"
+
complete $SECONDS
check_and_cleanup_lustre
exit_status