]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
common/rc: make _get_max_file_size find file size on mount point
authorAndrey Albershteyn <aalbersh@redhat.com>
Mon, 11 Sep 2023 20:06:17 +0000 (22:06 +0200)
committerZorro Lang <zlang@kernel.org>
Wed, 20 Sep 2023 07:49:54 +0000 (15:49 +0800)
Currently, _get_max_file_size finds max file size on $TEST_DIR.
The tests/generic/692 uses this function to detect file size and
then tries to create a file on $SCRATCH_MNT.

This works fine when test and scratch filesystems have the same
block size. However, it will fail if they differ.

Make _get_max_file_size accept mount point on which to detect max
file size.

Signed-off-by: Andrey Albershteyn <aalbersh@redhat.com>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/rc
tests/generic/299
tests/generic/485
tests/generic/692

index a438a8de146165e46e8a0fece2b1c88da980a932..76a7e774031814176721d6165f4d8cbf3fbbe530 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -4828,7 +4828,13 @@ _require_scratch_feature()
 # be UINT32_MAX * block_size, but other filesystems may allow up to LLONG_MAX.
 _get_max_file_size()
 {
-       local testfile=$TEST_DIR/maxfilesize.$seq
+       if [ -z $1 ] || [ ! -d $1 ]; then
+               echo "Missing mount point argument for _get_max_file_size"
+               exit 1
+       fi
+
+       local mnt=$1
+       local testfile=$mnt/maxfilesize.$seq
        local l=0
        local r=9223372036854775807 # LLONG_MAX
 
index d8ecff5384fb5e847e90cba0b3dae73ba7593747..0cd122029aa1a723864f916c7a48c2225e2d9d84 100755 (executable)
@@ -30,7 +30,7 @@ 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)
+max_file_size=$(_get_max_file_size $TEST_DIR)
 if [ $max_file_size -lt $FILE_SIZE ]; then
        FILE_SIZE=$max_file_size
 fi
index 3f7749ffd158ebfbbd74f8e2ede9dbe596dff393..8bab450ba3899f2dd04dbb92c37e81c85def3456 100755 (executable)
@@ -30,7 +30,7 @@ _require_xfs_io_command "finsert"
 _require_xfs_io_command "truncate"
 
 block_size=$(_get_file_block_size $TEST_DIR)
-max_file_size=$(_get_max_file_size)
+max_file_size=$(_get_max_file_size $TEST_DIR)
 max_blocks=$((max_file_size / block_size))
 testfile=$TEST_DIR/testfile.$seq
 
index 95f6ec04a409d250e11df47289675894b2e64611..3fb8ac01af1b1b27b6b7b85c58ca394d2db855b3 100755 (executable)
@@ -40,7 +40,7 @@ _scratch_mount
 
 fsv_file=$SCRATCH_MNT/file.fsv
 
-max_sz=$(_get_max_file_size)
+max_sz=$(_get_max_file_size $SCRATCH_MNT)
 _fsv_scratch_begin_subtest "way too big: fail on first merkle block"
 truncate -s $max_sz $fsv_file
 _fsv_enable $fsv_file |& _filter_scratch