define common _get_max_file_size function
cover define common _get_max_file_size function
We define a new function _get_max_file_size, and let generic/299, 351, 349 use this.
Yufen Yu (5):
commom/rc: define function _get_max_file_size generic/299: limit max file size
generic/351: use the common function _get_max_file_size generic/349: use the common function _get_max_file_size generic/350: use the common function _get_max_file_size
common/rc | 23 +++++++++++++++++++++++ tests/generic/299 | 5 +++++ tests/generic/349 | 13 ++----------- tests/generic/350 | 13 ++----------- tests/generic/351 | 13 ++----------- 5 files changed, 34 insertions(+), 33 deletions(-)
Signature · 1 line
2.16.2.dirty
PATCH 1/5 commom/rc: define function _get_max_file_size
Define a new function _get_max_file_size to return the max file size supported by the special filesystem.
--- common/rc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
common/rc +23 -0
@@ -3785,6 +3785,29 @@ _require_scratch_feature() esac } +# get filesystem max file size +_get_max_file_size() +{ + case $FSTYP in + vfat|jffs2|romfs) + echo $((2**32-1)) # 0xFFFFFFFF + ;; + *) # MAX_LFS_FILESIZE + case "$(getconf LONG_BIT)" in + "32") + echo $(( ($(getconf PAGE_SIZE) << ($(getconf LONG_BIT) - 1) ) - 1)) + ;; + "64") + echo "9223372036854775807" + ;; + *) + _fail "sizeof(long) == $(getconf LONG_BIT)?" + ;; + esac + ;; + esac +} + # The maximum filesystem label length, /not/ including terminating NULL _label_get_max() {
Signature · 1 line
2.16.2.dirty
Re: [PATCH 1/5] commom/rc: define function _get_max_file_size
Hi Yufen,
Quoted 28 lines · Yufen Yu
Define a new function
_get_max_file_sizeto return the max file size supported by the special filesystem.Signed-off-by Yufen Yu <[email protected]>--- common/rc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)common/rc +12
-0@@ -3785,6 +3785,29 @@ _require_scratch_feature() esac } +# get filesystem max file size +_get_max_file_size() +{ + case $FSTYP in + vfat|jffs2|romfs) + echo $((2**32-1)) # 0xFFFFFFFF + ;; + *) # MAX_LFS_FILESIZE + case "$(getconf LONG_BIT)" in + "32") + echo $(( ($(getconf PAGE_SIZE) << ($(getconf LONG_BIT) - 1) ) - 1)) + ;;
common/rc _require_scratch_feature() · line 3809
Quoted 10 lines
common/rc +10
-0+ "64") + echo "9223372036854775807" + ;; + *) + _fail "sizeof(long) == $(getconf LONG_BIT)?" + ;; + esac + ;; + esac +}
Why not move get_max_file_size() from tests/generic/485 to here instead?
- Eric
Re: [PATCH 1/5] commom/rc: define function _get_max_file_size
Quoted 19 lines · Eric Biggers
Hi Yufen,
Quoted 16 lines · Yufen Yu
Define a new function
_get_max_file_sizeto return the max file size supported by the special filesystem.Signed-off-by Yufen Yu <[email protected]>--- common/rc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)common/rc +0
-0@@ -3785,6 +3785,29 @@ _require_scratch_feature() esac }
Quoted 15 lines
Quoted 5 lines
common/rc +5
-0+# get filesystem max file size +_get_max_file_size() +{ + case $FSTYP in + vfat|jffs2|romfs)common/rc _require_scratch_feature() · line 3802
Quoted 10 lines
common/rc +10
-0+ echo $((2**32-1)) # 0xFFFFFFFF + ;; + *) # MAX_LFS_FILESIZE + case "$(getconf LONG_BIT)" in + "32") + echo $(( ($(getconf PAGE_SIZE) << ($(getconf LONG_BIT) - 1) ) - 1)) + ;; + "64") + echo "9223372036854775807" + ;;
I don't think this is correct. So ext4 always gets (8E-1) as the max file size on 64bit system in this case, but it actually supports (16T-4k) file if block size is 4k, and even smaller max file size when block size is 2k or 1k.
This function is from generic/351, but that's for test against a block dev not filesystem.
Quoted 9 lines
common/rc _require_scratch_feature() · line 3809
Quoted 7 lines
common/rc +7
-0+ *) + _fail "sizeof(long) == $(getconf LONG_BIT)?" + ;; + esac + ;; + esac +}Why not move
get_max_file_size()from tests/generic/485 to here instead?
Agree, the function in generic/485 would be better.
And I think the patchset should be in a single patch, which moves get_max_file_size() function from generic/485 to common/rc and update all related tests.
Thanks,
Eryu
Quoted 2 lines
- Eric
PATCH 2/5 generic/299: limit max file size
In reply to Yufen YuWe limit the max size and let the test go on running.
--- tests/generic/299 | 5 +++++ 1 file changed, 5 insertions(+)
tests/generic/299 +5 -0
@@ -33,6 +33,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
Signature · 1 line
2.16.2.dirty
PATCH 3/5 generic/351: use the common function _get_max_file_size
In reply to Yufen YuWe use common function _get_max_file_size to get the max file size supported by the filesystems and let the code be clean.
--- tests/generic/351 | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
tests/generic/351 +2 -11
@@ -62,17 +62,8 @@ $XFS_IO_PROG -c "fpunch 512 512" $dev echo "Zero range past MAX_LFS_FILESIZE keep size" # zod = MAX_LFS_FILESIZE -case "$(getconf LONG_BIT)" in -"32") - zod=$(( ($(getconf PAGE_SIZE) << ($(getconf LONG_BIT) - 1) ) - 1)) - ;; -"64") - zod=9223372036854775807 - ;; -*) - _fail "sizeof(long) == $(getconf LONG_BIT)?" - ;; -esac +zod=$(_get_max_file_size) + $XFS_IO_PROG -c "fzero -k 512k $zod" $dev echo "Zero range past MAX_LFS_FILESIZE"
Signature · 1 line
2.16.2.dirty
PATCH 4/5 generic/349: use the common function _get_max_file_size
In reply to Yufen YuWe use common function _get_max_file_size to get the max file size supported by the filesystems and let the code be clean.
--- tests/generic/349 | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
tests/generic/349 +2 -11
@@ -50,17 +50,8 @@ md5sum $dev | sed -e "s|$dev|SCSI_DEBUG_DEV|g" echo "Zero range to MAX_LFS_FILESIZE" # zod = MAX_LFS_FILESIZE -case "$(getconf LONG_BIT)" in -"32") - zod=$(( ($(getconf PAGE_SIZE) << ($(getconf LONG_BIT) - 1) ) - 1)) - ;; -"64") - zod=9223372036854775807 - ;; -*) - _fail "sizeof(long) == $(getconf LONG_BIT)?" - ;; -esac +zod=$(_get_max_file_size) + $XFS_IO_PROG -c "fzero -k 0 $zod" $dev echo "Check contents"
Signature · 1 line
2.16.2.dirty
PATCH 5/5 generic/350: use the common function _get_max_file_size
In reply to Yufen YuWe use common function _get_max_file_size to get the max file size supported by the filesystems and let the code be clean.
--- tests/generic/350 | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
tests/generic/350 +2 -11
@@ -47,17 +47,8 @@ md5sum $dev | sed -e "s|$dev|SCSI_DEBUG_DEV|g" echo "Punch to MAX_LFS_FILESIZE" # zod = MAX_LFS_FILESIZE -case "$(getconf LONG_BIT)" in -"32") - zod=$(( ($(getconf PAGE_SIZE) << ($(getconf LONG_BIT) - 1) ) - 1)) - ;; -"64") - zod=9223372036854775807 - ;; -*) - _fail "sizeof(long) == $(getconf LONG_BIT)?" - ;; -esac +zod=$(_get_max_file_size) + $XFS_IO_PROG -c "fpunch 0 $zod" $dev echo "Check contents"
Signature · 1 line
2.16.2.dirty