xfs/513: fix allocsize on archs with pagesize larger than blocksize

The minimum accepted allocsize mount option value is page size, which
causes the particular test to fail in architectures where page size >
block size. Fix it by basing the value on the platform page size rather
than the block size as obtained from mkfs. In addition add a filter so
that different values can be used without breaking the golden output.

Signed-off-by: Anthony Iliopoulos <ailiopoulos@suse.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This commit is contained in:
Anthony Iliopoulos
2020-03-07 11:54:57 +01:00
committed by Eryu Guan
parent 075c5fde2b
commit 915c740030
2 changed files with 11 additions and 5 deletions
+10 -4
View File
@@ -68,6 +68,11 @@ filter_loop()
-e "s,\B$LOOP_SPARE_DEV,LOOP_SPARE_DEV,g" -e "s,\B$LOOP_SPARE_DEV,LOOP_SPARE_DEV,g"
} }
filter_xfs_opt()
{
sed -e "s,allocsize=$pagesz,allocsize=PAGESIZE,g"
}
# avoid the effection from MKFS_OPTIONS # avoid the effection from MKFS_OPTIONS
MKFS_OPTIONS="" MKFS_OPTIONS=""
do_mkfs() do_mkfs()
@@ -165,7 +170,7 @@ do_test()
# Print each argument, include nil ones # Print each argument, include nil ones
echo -n "TEST:" | tee -a $seqres.full echo -n "TEST:" | tee -a $seqres.full
for i in "$@";do for i in "$@";do
echo -n " \"$i\"" | filter_loop | tee -a $seqres.full echo -n " \"$i\"" | filter_loop | filter_xfs_opt | tee -a $seqres.full
done done
echo | tee -a $seqres.full echo | tee -a $seqres.full
@@ -180,11 +185,12 @@ echo "** start xfs mount testing ..."
# Test allocsize=size # Test allocsize=size
# Valid values for this option are page size (typically 4KiB) through to 1GiB # Valid values for this option are page size (typically 4KiB) through to 1GiB
do_mkfs do_mkfs
if [ $dbsize -ge 1024 ];then pagesz=$(get_page_size)
blsize="$((dbsize / 1024))k" if [ $pagesz -ge 1024 ];then
pagesz="$((pagesz / 1024))k"
fi fi
do_test "" pass "allocsize" "false" do_test "" pass "allocsize" "false"
do_test "-o allocsize=$blsize" pass "allocsize=$blsize" "true" do_test "-o allocsize=$pagesz" pass "allocsize=$pagesz" "true"
do_test "-o allocsize=1048576k" pass "allocsize=1048576k" "true" do_test "-o allocsize=1048576k" pass "allocsize=1048576k" "true"
do_test "-o allocsize=$((dbsize / 2))" fail do_test "-o allocsize=$((dbsize / 2))" fail
do_test "-o allocsize=2g" fail do_test "-o allocsize=2g" fail
+1 -1
View File
@@ -5,7 +5,7 @@ QA output created by 513
** start xfs mount testing ... ** start xfs mount testing ...
FORMAT: FORMAT:
TEST: "" "pass" "allocsize" "false" TEST: "" "pass" "allocsize" "false"
TEST: "-o allocsize=4k" "pass" "allocsize=4k" "true" TEST: "-o allocsize=PAGESIZE" "pass" "allocsize=PAGESIZE" "true"
TEST: "-o allocsize=1048576k" "pass" "allocsize=1048576k" "true" TEST: "-o allocsize=1048576k" "pass" "allocsize=1048576k" "true"
TEST: "-o allocsize=2048" "fail" TEST: "-o allocsize=2048" "fail"
TEST: "-o allocsize=2g" "fail" TEST: "-o allocsize=2g" "fail"