]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
generic/299: limit max file size
authorYufen Yu <yuyufen@huawei.com>
Tue, 26 Feb 2019 14:11:53 +0000 (22:11 +0800)
committerEryu Guan <guaneryu@gmail.com>
Sat, 2 Mar 2019 09:18:54 +0000 (17:18 +0800)
For some filesystem, such as vfat, the max support file size is 4G.
We limit the max size and let the test go on running.

Fix it by moving the function get_max_file_size() of generci/485 to
common/rc, and add the max filesize limit to generic/299.

Signed-off-by: Yufen Yu <yuyufen@huawei.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/rc
tests/generic/299
tests/generic/485

index c88c304c3f0af52fbc4b0083755f43f7bd386b45..7d9a59e953aa067d7e9eff9af66f4eb08ac089bc 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -3810,6 +3810,29 @@ _require_scratch_feature()
        esac
 }
 
+# Get the maximum size of a file in $TEST_DIR (s_maxbytes).  On ext4 this will
+# be UINT32_MAX * block_size, but other filesystems may allow up to LLONG_MAX.
+_get_max_file_size()
+{
+       local testfile=$TEST_DIR/maxfilesize.$seq
+       local l=0
+       local r=9223372036854775807 # LLONG_MAX
+
+       rm -f $testfile
+       while (( l < r )); do
+               # Use _math() to avoid signed integer overflow.
+               local m=$(_math "($l + $r + 1) / 2")
+               if $XFS_IO_PROG -f -c "truncate $m" $testfile \
+                       |& grep -q 'File too large'
+               then
+                       r=$(( m - 1 ))
+               else
+                       l=$m
+               fi
+       done
+       echo $l
+}
+
 # The maximum filesystem label length, /not/ including terminating NULL
 _label_get_max()
 {
index c4d74fc8ddd75590c09e320847c7be88d06661f0..5e3d55df482fc6f37c5cee0240a7eebd9914da99 100755 (executable)
@@ -25,6 +25,7 @@ trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
 # real QA test starts here
 _supported_fs generic
 _supported_os Linux
+_require_test
 _require_scratch
 _require_odirect
 _require_block_device $SCRATCH_DEV
@@ -33,6 +34,11 @@ NUM_JOBS=$((4*LOAD_FACTOR))
 BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
 FILE_SIZE=$((BLK_DEV_SIZE * 512))
 
+max_file_size=$(_get_max_file_size)
+if [ $max_file_size -lt $FILE_SIZE ]; then
+       FILE_SIZE=$max_file_size
+fi
+
 cat >$fio_config <<EOF
 ###########
 # $seq test fio activity
index e88ac2e4923d9b3385128ac9e8602cab9658a5ae..126c166130f5b8353d5729c9a2f5d74c0b478554 100755 (executable)
@@ -37,31 +37,8 @@ _require_xfs_io_command "falloc" "-k"
 _require_xfs_io_command "finsert"
 _require_xfs_io_command "truncate"
 
-# Get the maximum size of a file in $TEST_DIR (s_maxbytes).  On ext4 this will
-# be UINT32_MAX * block_size, but other filesystems may allow up to LLONG_MAX.
-get_max_file_size()
-{
-       local testfile=$TEST_DIR/maxfilesize.$seq
-       local l=0
-       local r=9223372036854775807 # LLONG_MAX
-
-       rm -f $testfile
-       while (( l < r )); do
-               # Use _math() to avoid signed integer overflow.
-               local m=$(_math "($l + $r + 1) / 2")
-               if $XFS_IO_PROG -f -c "truncate $m" $testfile \
-                       |& grep -q 'File too large'
-               then
-                       r=$(( m - 1 ))
-               else
-                       l=$m
-               fi
-       done
-       echo $l
-}
-
 block_size=$(_get_file_block_size $TEST_DIR)
-max_file_size=$(get_max_file_size)
+max_file_size=$(_get_max_file_size)
 max_blocks=$((max_file_size / block_size))
 testfile=$TEST_DIR/testfile.$seq