Re: [PATCH 6/7] btrfs/301: Make this test compatible with all block sizes.

Qu Wenruo
2025-08-04T04:32:49Z

在 2025/7/29 15:51, Nirjhar Roy (IBM) 写道:
> With large block sizes like 64k on powerpc with 64k pagesize
> the test failed with the following logs:
>
> QA output created by 301
> basic accounting
> +subvol 256 mismatched usage 33947648 vs 4587520 \
> (expected data 4194304 expected meta 393216 diff 29360128)
> +subvol 256 mismatched usage 168165376 vs 138805248 \
> (expected data 138412032 expected meta 393216 diff 29360128)
> +subvol 256 mismatched usage 33947648 vs 4587520 \
> (expected data 4194304 expected meta 393216 diff 29360128)
> +subvol 256 mismatched usage 33947648 vs 4587520 \
> (expected data 4194304 expected meta 393216 diff 29360128)
> fallocate: Disk quota exceeded
> (Please note that the above ouptut had to be modified a bit since
> the number of characters in each line was much greater than the
> 72 characters.)

You don't need to break the line for raw output.

>
> The test creates nr_fill files each of size 8k i.e, 2x4k(stored in fill_sz).
> Now with 64k blocksize, 8k sized files occupy more than expected
> sizes (i.e, 8k) due to internal fragmentation since 1 file
> will occupy at least 1 block. Fix this by scaling the file size (fill_sz)
> with the blocksize.

You can just replace the fill_sz to 64K so that all block sizes will work.

Just tested with 64K fill_sz, it works for both 4K and 64K block size
with 64K page size.

Thanks,
Qu

>
> Reported-by: Disha Goel <disgoel@linux.ibm.com>
> Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>
> ---
> tests/btrfs/301 | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/tests/btrfs/301 b/tests/btrfs/301
> index 6b59749d..7547ff0e 100755
> --- a/tests/btrfs/301
> +++ b/tests/btrfs/301
> @@ -23,7 +23,13 @@ subv=$SCRATCH_MNT/subv
> nested=$SCRATCH_MNT/subv/nested
> snap=$SCRATCH_MNT/snap
> nr_fill=512
> -fill_sz=$((8 * 1024))
> +
> +_scratch_mkfs >> $seqres.full
> +_scratch_mount
> +blksz=`_get_block_size $SCRATCH_MNT`
> +_scratch_unmount
> +fill_sz=$(( 2 * blksz ))
> +
> total_fill=$(($nr_fill * $fill_sz))
> nodesize=$($BTRFS_UTIL_PROG inspect-internal dump-super $SCRATCH_DEV | \
> grep nodesize | $AWK_PROG '{print $2}')