fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfs/513: fix allocsize on archs with pagesize larger than blocksize
@ 2020-03-07  0:44 Anthony Iliopoulos
  2020-03-07  7:15 ` Zorro Lang
  0 siblings, 1 reply; 3+ messages in thread
From: Anthony Iliopoulos @ 2020-03-07  0:44 UTC (permalink / raw)
  To: fstests; +Cc: Anthony Iliopoulos

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>
---
 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..2c2c0404 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_pagesz()
+{
+	sed -e "s,allocsize=$pagesz,allocsize=PAGE_SIZE,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_pagesz | 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..f676a289 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=PAGE_SIZE" "pass" "allocsize=PAGE_SIZE" "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 related	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfs/513: fix allocsize on archs with pagesize larger than blocksize
  2020-03-07  0:44 [PATCH] xfs/513: fix allocsize on archs with pagesize larger than blocksize Anthony Iliopoulos
@ 2020-03-07  7:15 ` Zorro Lang
  2020-03-07 10:51   ` Anthony Iliopoulos
  0 siblings, 1 reply; 3+ messages in thread
From: Zorro Lang @ 2020-03-07  7:15 UTC (permalink / raw)
  To: Anthony Iliopoulos; +Cc: fstests

On Sat, Mar 07, 2020 at 01:44:07AM +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>
> ---

Hi,

Thanks for this patch, I've forgotten that I tried to fix it:
https://marc.info/?l=fstests&m=158250811523489&w=2

And looks like Eryu prefer filtering the PAGESIZE, he might like to merge
this one:)

The patch looks good to me, only one slight thing. The filter_pagesz() is
not used to filter "$pagesize" itself, it filters "allocsize=$pagesize"
actually. So how about name it as filter_xfs_options (or something like that),
then we might add more lines(filter) in it later?

Thanks,
Zorro

>  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..2c2c0404 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_pagesz()
> +{
> +	sed -e "s,allocsize=$pagesz,allocsize=PAGE_SIZE,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_pagesz | 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..f676a289 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=PAGE_SIZE" "pass" "allocsize=PAGE_SIZE" "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] 3+ messages in thread

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

On Sat, Mar 07, 2020 at 03:15:12PM +0800, Zorro Lang wrote:
> On Sat, Mar 07, 2020 at 01:44:07AM +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>
> > ---
> 
> Hi,
> 
> Thanks for this patch, I've forgotten that I tried to fix it:
> https://marc.info/?l=fstests&m=158250811523489&w=2
> 
> And looks like Eryu prefer filtering the PAGESIZE, he might like to merge
> this one:)

I missed that, but assumed that the intention of the test was to cover
the minimum allowable value on the allocsize range and not just the
parsing, so I made it variable. Either way it's fine as long as the test
covers the intended purpose.

> The patch looks good to me, only one slight thing. The filter_pagesz() is
> not used to filter "$pagesize" itself, it filters "allocsize=$pagesize"
> actually. So how about name it as filter_xfs_options (or something like that),
> then we might add more lines(filter) in it later?

Thanks for the review, yes this makes sense, so I'll send a v2 shortly
with the changes.

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

end of thread, other threads:[~2020-03-07 10:51 UTC | newest]

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).