diff mbox series

[5/8] xfs/599: reduce the amount of attrs created here

Message ID 170899915290.896550.10775908547486721272.stgit@frogsfrogsfrogs (mailing list archive)
State New
Headers show
Series [1/8] generic/604: try to make race occur reliably | expand

Commit Message

Darrick J. Wong Feb. 27, 2024, 2:01 a.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

Luis Chamberlain reported insane runtimes in this test:

"xfs/599 takes a long time on LBS, but it passes. The amount of time it
takes, however, begs the question if the test is could be trimmed to do
less work because the larger the block size the larger the number of
dirents and xattrs are used to create. The large dirents are not a
problem. The amount of time it takes to create xattrs with hashcol
however grows exponentially in time.

"n=16k   takes 5   seconds
"n=32k   takes 30  seconds
"n=64k     takes 6-7 minutes
"n=1048576 takes 30 hours

"n=1048576 is what we use for block size 32k.

"Do we really need so many xattrs for larger block sizes for this test?"

No, we don't.  The goal of this test is to create a two-level dabtree of
xattrs having identical hashes.  However, the test author (me)
apparently forgot that if a dabtree is created in the attr fork, there
will be a dabtree entry for each extended attribute, not each attr leaf
block.  Hence it's a waste of time to multiply da_records_per_block by
attr_records_per_block.

Reported-by: Luis Chamberlain <mcgrof@kernel.org>
Fixes: 1cd6b61299 ("xfs: add a couple more tests for ascii-ci problems")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 tests/xfs/599 |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

Zorro Lang Feb. 27, 2024, 4:33 a.m. UTC | #1
On Mon, Feb 26, 2024 at 06:01:50PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Luis Chamberlain reported insane runtimes in this test:
> 
> "xfs/599 takes a long time on LBS, but it passes. The amount of time it
> takes, however, begs the question if the test is could be trimmed to do
> less work because the larger the block size the larger the number of
> dirents and xattrs are used to create. The large dirents are not a
> problem. The amount of time it takes to create xattrs with hashcol
> however grows exponentially in time.
> 
> "n=16k   takes 5   seconds
> "n=32k   takes 30  seconds
> "n=64k     takes 6-7 minutes
> "n=1048576 takes 30 hours
> 
> "n=1048576 is what we use for block size 32k.
> 
> "Do we really need so many xattrs for larger block sizes for this test?"
> 
> No, we don't.  The goal of this test is to create a two-level dabtree of
> xattrs having identical hashes.  However, the test author (me)
> apparently forgot that if a dabtree is created in the attr fork, there
> will be a dabtree entry for each extended attribute, not each attr leaf
> block.  Hence it's a waste of time to multiply da_records_per_block by
> attr_records_per_block.
> 
> Reported-by: Luis Chamberlain <mcgrof@kernel.org>
> Fixes: 1cd6b61299 ("xfs: add a couple more tests for ascii-ci problems")
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---

Thanks for this fix, it save much time for us too :)

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

>  tests/xfs/599 |    9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> 
> diff --git a/tests/xfs/599 b/tests/xfs/599
> index b55b62d7f5..57a797f0f5 100755
> --- a/tests/xfs/599
> +++ b/tests/xfs/599
> @@ -43,14 +43,13 @@ longname="$(mktemp --dry-run "$(perl -e 'print "X" x 255;')" | tr ' ' 'X')"
>  echo "creating $nr_dirents dirents from '$longname'" >> $seqres.full
>  _scratch_xfs_db -r -c "hashcoll -n $nr_dirents -p $crash_dir $longname"
>  
> -# Create enough xattrs to fill two dabtree nodes.  Each attribute leaf block
> -# gets its own record in the dabtree, so we have to create enough attr blocks
> -# (each full of attrs) to get a dabtree of at least height 2.
> +# Create enough xattrs to fill two dabtree nodes.  Each attribute entry gets
> +# its own record in the dabtree, so we have to create enough attributes to get
> +# a dabtree of at least height 2.
>  blksz=$(_get_block_size "$SCRATCH_MNT")
>  
> -attr_records_per_block=$((blksz / 255))
>  da_records_per_block=$((blksz / 8))	# 32-bit hash and 32-bit before
> -nr_attrs=$((da_records_per_block * attr_records_per_block * 2))
> +nr_attrs=$((da_records_per_block * 2))
>  
>  longname="$(mktemp --dry-run "$(perl -e 'print "X" x 249;')" | tr ' ' 'X')"
>  echo "creating $nr_attrs attrs from '$longname'" >> $seqres.full
>
diff mbox series

Patch

diff --git a/tests/xfs/599 b/tests/xfs/599
index b55b62d7f5..57a797f0f5 100755
--- a/tests/xfs/599
+++ b/tests/xfs/599
@@ -43,14 +43,13 @@  longname="$(mktemp --dry-run "$(perl -e 'print "X" x 255;')" | tr ' ' 'X')"
 echo "creating $nr_dirents dirents from '$longname'" >> $seqres.full
 _scratch_xfs_db -r -c "hashcoll -n $nr_dirents -p $crash_dir $longname"
 
-# Create enough xattrs to fill two dabtree nodes.  Each attribute leaf block
-# gets its own record in the dabtree, so we have to create enough attr blocks
-# (each full of attrs) to get a dabtree of at least height 2.
+# Create enough xattrs to fill two dabtree nodes.  Each attribute entry gets
+# its own record in the dabtree, so we have to create enough attributes to get
+# a dabtree of at least height 2.
 blksz=$(_get_block_size "$SCRATCH_MNT")
 
-attr_records_per_block=$((blksz / 255))
 da_records_per_block=$((blksz / 8))	# 32-bit hash and 32-bit before
-nr_attrs=$((da_records_per_block * attr_records_per_block * 2))
+nr_attrs=$((da_records_per_block * 2))
 
 longname="$(mktemp --dry-run "$(perl -e 'print "X" x 249;')" | tr ' ' 'X')"
 echo "creating $nr_attrs attrs from '$longname'" >> $seqres.full