common/rc: make _get_max_file_size find file size on mount point
PATCH 1/1 common/rc: make _get_max_file_size find file size on mount point
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, for example, TEST is 4k and SCRATCH is 1k (file will be too big).
Found this by running generic/692 on ext4 with -b 1024.
Make _get_max_file_size accept mount point on which to detect max file size.
--- common/rc | 8 +++++++- tests/generic/299 | 2 +- tests/generic/485 | 2 +- tests/generic/692 | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-)
common/rc +7 -1
@@ -4809,7 +4809,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
tests/generic/299 +1 -1
@@ -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
tests/generic/485 +1 -1
@@ -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
tests/generic/692 +1 -1
@@ -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
Signature · 1 line
2.40.1
Quoted 7 lines · Andrey Albershteyn
Currently,
_get_max_file_sizefinds 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, for example, TEST is 4k and SCRATCH is 1k (file will be too big).
I thought we generally use same mkfs options on TEST_DEV and SCRATCH_DEV. If you'd like to test 1k blocksize ext4, shouldn't you make 1k blocksize ext4 on TEST_DEV before testing.
Thanks,
Zorro
Quoted 75 lines
Found this by running generic/692 on ext4 with -b 1024.
Make
_get_max_file_sizeaccept mount point on which to detect max file size.Signed-off-by Andrey Albershteyn <[email protected]>--- common/rc | 8 +++++++- tests/generic/299 | 2 +- tests/generic/485 | 2 +- tests/generic/692 | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-)common/rc +7
-1@@ -4809,7 +4809,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_MAXtests/generic/299 +1
-1@@ -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 fitests/generic/485 +1
-1@@ -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.$seqtests/generic/692 +1
-1@@ -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_scratchSignature · 1 line
2.40.1
Darrick J. Wong
Reviewed-byQuoted 5 lines · Zorro Lang
Quoted 4 lines · Andrey Albershteyn
Currently,
_get_max_file_sizefinds 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.
Quoted 7 lines
Quoted 3 lines
This works fine when test and scratch filesystems have the same block size. However, it will fail if they differ, for example, TEST is 4k and SCRATCH is 1k (file will be too big).
I thought we generally use same mkfs options on
TEST_DEVandSCRATCH_DEV. If you'd like to test 1k blocksize ext4, shouldn't you make 1k blocksize ext4 onTEST_DEVbefore testing.
Agreed, TEST_DEV (AFAIK) is supposed to have the same options as SCRATCH_MNT.
That said, I support adding the flexibility to supply a mount point, since that would be generally useful given the number of tests that add things to MKFS_OPTIONS...
Quoted 68 lines
Thanks,
ZorroQuoted 65 lines
Found this by running generic/692 on ext4 with -b 1024.
Make
_get_max_file_sizeaccept mount point on which to detect max file size.Signed-off-by Andrey Albershteyn <[email protected]>--- common/rc | 8 +++++++- tests/generic/299 | 2 +- tests/generic/485 | 2 +- tests/generic/692 | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-)common/rc +7
-1@@ -4809,7 +4809,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_MAXtests/generic/299 +1
-1@@ -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 fitests/generic/485 +1
-1@@ -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.$seqtests/generic/692 +0
-0@@ -40,7 +40,7 @@ _scratch_mount
Quoted 4 lines
tests/generic/692 _scratch_mount · line 43
Quoted 4 lines
tests/generic/692 +1
-1fsv_file=$SCRATCH_MNT/file.fsv -max_sz=$(_get_max_file_size) +max_sz=$(_get_max_file_size $SCRATCH_MNT)
...LGTM, so
--D
Quoted 7 lines
Quoted 6 lines
tests/generic/692 +0
-0_fsv_scratch_begin_subtest "way too big: fail on first merkle block" truncate -s $max_sz $fsv_file _fsv_enable $fsv_file |& _filter_scratchSignature · 1 line
2.40.1
Quoted 10 lines · Darrick J. Wong
Quoted 9 lines · Zorro Lang
Quoted 7 lines · Andrey Albershteyn
Currently,
_get_max_file_sizefinds 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, for example, TEST is 4k and SCRATCH is 1k (file will be too big).
Quoted 6 lines
Quoted 3 lines
I thought we generally use same mkfs options on
TEST_DEVandSCRATCH_DEV. If you'd like to test 1k blocksize ext4, shouldn't you make 1k blocksize ext4 onTEST_DEVbefore testing.Agreed,
TEST_DEV(AFAIK) is supposed to have the same options asSCRATCH_MNT.
Make sense but I didn't know that this is required, would it make sense to add a check for at least block size? I was running -s ext4_1k -s ext4_4k without recreating the TEST_DEV and that wasn't obvious where the problem is as test is using SCRATCH.
Quoted 73 lines
That said, I support adding the flexibility to supply a mount point, since that would be generally useful given the number of tests that add things to
MKFS_OPTIONS...Quoted 68 lines
Thanks,
ZorroQuoted 65 lines
Found this by running generic/692 on ext4 with -b 1024.
Make
_get_max_file_sizeaccept mount point on which to detect max file size.Signed-off-by Andrey Albershteyn <[email protected]>--- common/rc | 8 +++++++- tests/generic/299 | 2 +- tests/generic/485 | 2 +- tests/generic/692 | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-)common/rc +7
-1@@ -4809,7 +4809,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_MAXtests/generic/299 +1
-1@@ -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 fitests/generic/485 +1
-1@@ -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.$seqtests/generic/692 +0
-0@@ -40,7 +40,7 @@ _scratch_mount
Quoted 8 lines
Quoted 4 lines
tests/generic/692 _scratch_mount · line 43
Quoted 4 lines
tests/generic/692 +1
-1fsv_file=$SCRATCH_MNT/file.fsv -max_sz=$(_get_max_file_size) +max_sz=$(_get_max_file_size $SCRATCH_MNT)...LGTM, so
Reviewed-by Darrick J. Wong <[email protected]>
Thanks!
Quoted 10 lines
--D
Quoted 7 lines
Quoted 6 lines
tests/generic/692 +0
-0_fsv_scratch_begin_subtest "way too big: fail on first merkle block" truncate -s $max_sz $fsv_file _fsv_enable $fsv_file |& _filter_scratchSignature · 1 line
2.40.1
Signature · 1 line
- Andrey
Quoted 15 lines · Andrey Albershteyn
Quoted 14 lines · Darrick J. Wong
Quoted 12 lines · Zorro Lang
Quoted 7 lines · Andrey Albershteyn
Currently,
_get_max_file_sizefinds 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, for example, TEST is 4k and SCRATCH is 1k (file will be too big).
I thought we generally use same mkfs options on
TEST_DEVandSCRATCH_DEV. If you'd like to test 1k blocksize ext4, shouldn't you make 1k blocksize ext4 onTEST_DEVbefore testing.
Quoted 7 lines
Quoted 2 lines
Agreed,
TEST_DEV(AFAIK) is supposed to have the same options asSCRATCH_MNT.Make sense but I didn't know that this is required, would it make sense to add a check for at least block size? I was running -s
ext4_1k-sext4_4kwithout recreating theTEST_DEVand that wasn't obvious where the problem is as test is using SCRATCH.
I remembered there's a global parameter named "RECREATE_TEST_DEV", if it's "true", the TEST_DEV will be recreated after a section testing done. You can check if it works :)
Quoted 99 lines
Quoted 74 lines
That said, I support adding the flexibility to supply a mount point, since that would be generally useful given the number of tests that add things to
MKFS_OPTIONS...Quoted 68 lines
Thanks,
ZorroQuoted 65 lines
Found this by running generic/692 on ext4 with -b 1024.
Make
_get_max_file_sizeaccept mount point on which to detect max file size.Signed-off-by Andrey Albershteyn <[email protected]>--- common/rc | 8 +++++++- tests/generic/299 | 2 +- tests/generic/485 | 2 +- tests/generic/692 | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-)common/rc +7
-1@@ -4809,7 +4809,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_MAXtests/generic/299 +1
-1@@ -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 fitests/generic/485 +1
-1@@ -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.$seqtests/generic/692 +0
-0@@ -40,7 +40,7 @@ _scratch_mountQuoted 8 lines
Quoted 4 lines
tests/generic/692 _scratch_mount · line 43
Quoted 4 lines
tests/generic/692 +1
-1fsv_file=$SCRATCH_MNT/file.fsv -max_sz=$(_get_max_file_size) +max_sz=$(_get_max_file_size $SCRATCH_MNT)...LGTM, so
Reviewed-by Darrick J. Wong <[email protected]>Thanks!
Quoted 10 lines
--D
Quoted 7 lines
Quoted 6 lines
tests/generic/692 +0
-0_fsv_scratch_begin_subtest "way too big: fail on first merkle block" truncate -s $max_sz $fsv_file _fsv_enable $fsv_file |& _filter_scratchSignature · 1 line
2.40.1Signature · 1 line
- Andrey