Re: [PATCH 5/7] generic/563: Increase the write tolerance to 6% for larger nodesize

Nirjhar Roy (IBM)
2025-08-12T06:27:48Z

On 8/4/25 09:58, Qu Wenruo wrote:
>
>
> 在 2025/7/29 15:51, Nirjhar Roy (IBM) 写道:
>> When tested with blocksize/nodesize 64K on powerpc
>> with 64k  pagesize on btrfs, then the test fails
>> with the folllowing error:
>>       QA output created by 563
>>       read/write
>>       read is in range
>>      -write is in range
>>      +write has value of 8855552
>>      +write is NOT in range 7969177.6 .. 8808038.4
>
> I can reproduce the failure, although it's not 100% reliable, and
> indeed with one tree block's size removed, it's back into the
> tolerance range.
>
>>       write -> read/write
>>      ...
>> The slight increase in the amount of bytes that
>> are written is because of the increase in the
>> the nodesize(metadata) and hence it exceeds the tolerance limit
>> slightly.
>> Fix this by increasing the write tolerance limit from 5% from 6%
>> for 64k blocksize btrfs.
>>
>> Reported-by: Disha Goel <disgoel@linux.ibm.com>
>> Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>
>> ---
>>   tests/generic/563 | 17 ++++++++++++++++-
>>   1 file changed, 16 insertions(+), 1 deletion(-)
>>
>> diff --git a/tests/generic/563 b/tests/generic/563
>> index 89a71aa4..efcac1ec 100755
>> --- a/tests/generic/563
>> +++ b/tests/generic/563
>> @@ -119,7 +119,22 @@ $XFS_IO_PROG -c "pread 0 $iosize" -c "pwrite -b
>> $blksize 0 $iosize" -c fsync \
>>       $SCRATCH_MNT/file >> $seqres.full 2>&1
>>   switch_cg $cgdir
>>   $XFS_IO_PROG -c fsync $SCRATCH_MNT/file
>> -check_cg $cgdir/$seq-cg $iosize $iosize 5% 5%
>> +blksz=`_get_block_size $SCRATCH_MNT`
>> +
>> +# On higher node sizes on btrfs, we observed slightly more
>> +# writes, due to increased metadata sizes.
>> +# Hence have a higher write tolerance for btrfs and when
>> +# node size is greater than 4k.
>> +if [[ "$FSTYP" == "btrfs" ]]; then
>> +    nodesz=$(_get_btrfs_node_size "$SCRATCH_DEV")
>> +    if [[ "$nodesz" -gt 4096 ]]; then
>> +        check_cg $cgdir/$seq-cg $iosize $iosize 5% 6%
>> +    else
>> +        check_cg $cgdir/$seq-cg $iosize $iosize 5% 5%
>> +    fi
>> +else
>> +    check_cg $cgdir/$seq-cg $iosize $iosize 5% 5%
>> +fi
>
> Instead of the btrfs specific hack, I'd recommend to just enlarge iosize.
>
> Double the iosize will easily make it to cover the tolerance of even
> btrfs, but you still need a proper explanation of the change.

Okay. I can try the above and will come up with more detailed explantion.

--NR

>
> Thanks,
> Qu
>
>>     # Write from one cgroup then read and write from a second. Writes
>> are charged to
>>   # the first group and nothing to the second.
>
--
Nirjhar Roy
Linux Kernel Developer
IBM, Bangalore