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

Zorro Lang
2024-02-27T04:33:50Z

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
>