FSTests Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v2] xfs/513: fix allocsize on archs with pagesize larger than blocksize
@ 2020-03-07 10:54 Anthony Iliopoulos
  2020-03-07 14:14 ` Zorro Lang
  0 siblings, 1 reply; 2+ messages in thread
From: Anthony Iliopoulos @ 2020-03-07 10:54 UTC (permalink / raw)
  To: fstests; +Cc: zlang

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>
---

Changes from v1 -> v2:

- renamed filter_pagesz to filter_xfs_opt
- renamed PAGE_SIZE to PAGESIZE

 tests/xfs/513     | 14 ++++++++++----
 tests/xfs/513.out |  2 +-
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/tests/xfs/513 b/tests/xfs/513
index 70bc2f1c..094d0c6c 100755
--- a/tests/xfs/513
+++ b/tests/xfs/513
@@ -68,6 +68,11 @@ filter_loop()
 	    -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
 MKFS_OPTIONS=""
 do_mkfs()
@@ -165,7 +170,7 @@ do_test()
 	# Print each argument, include nil ones
 	echo -n "TEST:" | tee -a $seqres.full
 	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
 	echo | tee -a $seqres.full
 
@@ -180,11 +185,12 @@ echo "** start xfs mount testing ..."
 # Test allocsize=size
 # Valid values for this option are page size (typically 4KiB) through to 1GiB
 do_mkfs
-if [ $dbsize -ge 1024 ];then
-	blsize="$((dbsize / 1024))k"
+pagesz=$(get_page_size)
+if [ $pagesz -ge 1024 ];then
+	pagesz="$((pagesz / 1024))k"
 fi
 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=$((dbsize / 2))" fail
 do_test "-o allocsize=2g" fail
diff --git a/tests/xfs/513.out b/tests/xfs/513.out
index 9be18dd8..6681a7e8 100644
--- a/tests/xfs/513.out
+++ b/tests/xfs/513.out
@@ -5,7 +5,7 @@ QA output created by 513
 ** start xfs mount testing ...
 FORMAT: 
 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=2048" "fail"
 TEST: "-o allocsize=2g" "fail"
-- 
2.16.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] xfs/513: fix allocsize on archs with pagesize larger than blocksize
  2020-03-07 10:54 [PATCH v2] xfs/513: fix allocsize on archs with pagesize larger than blocksize Anthony Iliopoulos
@ 2020-03-07 14:14 ` Zorro Lang
  0 siblings, 0 replies; 2+ messages in thread
From: Zorro Lang @ 2020-03-07 14:14 UTC (permalink / raw)
  To: Anthony Iliopoulos; +Cc: fstests

On Sat, Mar 07, 2020 at 11:54:57AM +0100, Anthony Iliopoulos wrote:
> 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>
> ---

Looks good to me.

Reviewed-by: Zorro Lang <zlang@redhat.com>

> 
> Changes from v1 -> v2:
> 
> - renamed filter_pagesz to filter_xfs_opt
> - renamed PAGE_SIZE to PAGESIZE
> 
>  tests/xfs/513     | 14 ++++++++++----
>  tests/xfs/513.out |  2 +-
>  2 files changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/tests/xfs/513 b/tests/xfs/513
> index 70bc2f1c..094d0c6c 100755
> --- a/tests/xfs/513
> +++ b/tests/xfs/513
> @@ -68,6 +68,11 @@ filter_loop()
>  	    -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
>  MKFS_OPTIONS=""
>  do_mkfs()
> @@ -165,7 +170,7 @@ do_test()
>  	# Print each argument, include nil ones
>  	echo -n "TEST:" | tee -a $seqres.full
>  	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
>  	echo | tee -a $seqres.full
>  
> @@ -180,11 +185,12 @@ echo "** start xfs mount testing ..."
>  # Test allocsize=size
>  # Valid values for this option are page size (typically 4KiB) through to 1GiB
>  do_mkfs
> -if [ $dbsize -ge 1024 ];then
> -	blsize="$((dbsize / 1024))k"
> +pagesz=$(get_page_size)
> +if [ $pagesz -ge 1024 ];then
> +	pagesz="$((pagesz / 1024))k"
>  fi
>  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=$((dbsize / 2))" fail
>  do_test "-o allocsize=2g" fail
> diff --git a/tests/xfs/513.out b/tests/xfs/513.out
> index 9be18dd8..6681a7e8 100644
> --- a/tests/xfs/513.out
> +++ b/tests/xfs/513.out
> @@ -5,7 +5,7 @@ QA output created by 513
>  ** start xfs mount testing ...
>  FORMAT: 
>  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=2048" "fail"
>  TEST: "-o allocsize=2g" "fail"
> -- 
> 2.16.4
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-07 10:54 [PATCH v2] xfs/513: fix allocsize on archs with pagesize larger than blocksize Anthony Iliopoulos
2020-03-07 14:14 ` Zorro Lang

FSTests Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/fstests/0 fstests/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 fstests fstests/ https://lore.kernel.org/fstests \
		fstests@vger.kernel.org
	public-inbox-index fstests

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.fstests


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git