Re: [PATCH 5/6] xfs/534: Fix test to execute in multi-block directory config

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 25, 2021 at 07:38:56PM +0530, Chandan Babu R wrote:
> xfs/534 attempts to create $testfile after reduce_max_iextents error tag is
> injected. Creation of $testfile fails when using a multi-block directory test
> configuration because,
> 1. A directory can have a pseudo maximum extent count of 10.
> 2. In the worst case a directory entry creation operation can consume
>    (XFS_DA_NODE_MAXDEPTH + 1 + 1) * (Nr fs blocks in a single directory block)
>    extents.
>    With 1k fs block size and 4k directory block size, this evaluates to,
>    (5 + 1 + 1) * 4
>    = 7 * 4
>    = 28
>    > 10 (Pseudo maximum inode extent count).
> 
> This commit fixes the issue by creating $testfile before injecting
> reduce_max_iextents error tag.
> 
> Reported-by: Darrick J. Wong <djwong@xxxxxxxxxx>
> Suggested-by: Darrick J. Wong <djwong@xxxxxxxxxx>
> Signed-off-by: Chandan Babu R <chandanrlinux@xxxxxxxxx>

Looks good to me,
Reviewed-by: Darrick J. Wong <djwong@xxxxxxxxxx>

--D

> ---
>  tests/xfs/534     | 9 ++++++---
>  tests/xfs/534.out | 5 ++++-
>  2 files changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/xfs/534 b/tests/xfs/534
> index a8348526..338282ef 100755
> --- a/tests/xfs/534
> +++ b/tests/xfs/534
> @@ -45,9 +45,6 @@ bsize=$(_get_file_block_size $SCRATCH_MNT)
>  
>  testfile=${SCRATCH_MNT}/testfile
>  
> -echo "Inject reduce_max_iextents error tag"
> -_scratch_inject_error reduce_max_iextents 1
> -
>  nr_blks=15
>  
>  for io in Buffered Direct; do
> @@ -62,6 +59,9 @@ for io in Buffered Direct; do
>  		xfs_io_flag="-d"
>  	fi
>  
> +	echo "Inject reduce_max_iextents error tag"
> +	_scratch_inject_error reduce_max_iextents 1
> +
>  	echo "$io write to every other block of fallocated space"
>  	for i in $(seq 1 2 $((nr_blks - 1))); do
>  		$XFS_IO_PROG -f -s $xfs_io_flag -c "pwrite $((i * bsize)) $bsize" \
> @@ -76,6 +76,9 @@ for io in Buffered Direct; do
>  		exit 1
>  	fi
>  
> +	echo "Disable reduce_max_iextents error tag"
> +	_scratch_inject_error reduce_max_iextents 0
> +
>  	rm $testfile
>  done
>  
> diff --git a/tests/xfs/534.out b/tests/xfs/534.out
> index f7c0821b..0a0cd3a6 100644
> --- a/tests/xfs/534.out
> +++ b/tests/xfs/534.out
> @@ -1,11 +1,14 @@
>  QA output created by 534
>  Format and mount fs
> -Inject reduce_max_iextents error tag
>  * Buffered write to unwritten extent
>  Fallocate 15 blocks
> +Inject reduce_max_iextents error tag
>  Buffered write to every other block of fallocated space
>  Verify $testfile's extent count
> +Disable reduce_max_iextents error tag
>  * Direct write to unwritten extent
>  Fallocate 15 blocks
> +Inject reduce_max_iextents error tag
>  Direct write to every other block of fallocated space
>  Verify $testfile's extent count
> +Disable reduce_max_iextents error tag
> -- 
> 2.29.2
> 



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux