Whamcloud - gitweb
LU-14128 lov: correctly set OST obj size
[fs/lustre-release.git] / lustre / tests / sanity-pfl.sh
index e83a9fe..664acc2 100644 (file)
@@ -21,6 +21,10 @@ if [[ $(uname -m) = ppc64 ]]; then
        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
@@ -72,21 +76,58 @@ test_0b() {
 
        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_1a() {
        local comp_file=$DIR/$tdir/$tfile
        local rw_len=$((3 * 1024 * 1024))       # 3M
@@ -515,7 +556,7 @@ test_10() {
 }
 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
@@ -566,7 +607,22 @@ test_11() {
 
        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"
@@ -2206,6 +2262,66 @@ test_23f() {
 }
 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"
+
 complete $SECONDS
 check_and_cleanup_lustre
 exit_status