Re: [PATCH 4/7] btrfs/200: Make this test scale with the block size

Nirjhar Roy (IBM)
2025-08-12T06:26:18Z

On 7/29/25 12:23, Filipe Manana wrote:
> On Tue, Jul 29, 2025 at 7:24 AM Nirjhar Roy (IBM)
> <nirjhar.roy.lists@gmail.com> wrote:
>> For large block sizes like 64k on powerpc with 64k
>> pagesize it failed because this test was hardcoded
>> to work with 4k blocksize.
> Where exactly is it hardcoded with 4K blocksize expectations?
>
> The test does 64K writes and reflinks at offsets multiples of 64K (0 and 64K).
> In fact that's why the test is doing 64K writes and using only the
> file offsets 0 and 64K, so that it works with any block size.
>
>> With blocksize 4k and the existing file lengths,
>> we are getting 2 extents but with 64k page size
>> number of extents is not exceeding 1(due to lower
>> file size).
> Due to lower file size? How?
> The file sizes should be independent of the block size, and be 64K and
> 128K everywhere.
>
> Please provide more details in the changelog.
> Thanks.

Yes, I think I mis-interpreted the actual issue. I am looking into this.
For now, I will remove this patch in the next version and once I am
aware of the actual root cause, I will re-send with a proper fix and an
explanation.

--NR

>
>> The first few lines of the error message is as follows:
>> At snapshot incr
>> OK
>> OK
>> +File foo does not have 2 shared extents in the base snapshot
>> +/mnt/scratch/base/foo:
>> + 0: [0..255]: 26624..26879
>> +File foo does not have 2 shared extents in the incr snapshot
>> ...
>>
>> Fix this by scaling the size and offsets to scale with the block
>> size by a factor of (blocksize/4k).
>>
>> Reported-by: Disha Goel <disgoel@linux.ibm.com>
>> Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>
>> ---
>> tests/btrfs/200 | 24 ++++++++++++++++--------
>> tests/btrfs/200.out | 8 ++++----
>> 2 files changed, 20 insertions(+), 12 deletions(-)
>>
>> diff --git a/tests/btrfs/200 b/tests/btrfs/200
>> index e62937a4..fd2c2026 100755
>> --- a/tests/btrfs/200
>> +++ b/tests/btrfs/200
>> @@ -35,18 +35,26 @@ mkdir $send_files_dir
>> _scratch_mkfs >>$seqres.full 2>&1
>> _scratch_mount
>>
>> +blksz=`_get_block_size $SCRATCH_MNT`
>> +echo "block size = $blksz" >> $seqres.full
>> +
>> +# Scale the test with any block size starting from 1k
>> +scale=$(( blksz / 1024 ))
>> +offset=$(( 16 * 1024 * scale ))
>> +size=$(( 16 * 1024 * scale ))
>> +
>> # Create our first test file, which has an extent that is shared only with
>> # itself and no other files. We want to verify a full send operation will
>> # clone the extent.
>> -$XFS_IO_PROG -f -c "pwrite -S 0xb1 -b 64K 0 64K" $SCRATCH_MNT/foo \
>> - | _filter_xfs_io
>> -$XFS_IO_PROG -c "reflink $SCRATCH_MNT/foo 0 64K 64K" $SCRATCH_MNT/foo \
>> - | _filter_xfs_io
>> +$XFS_IO_PROG -f -c "pwrite -S 0xb1 -b $size 0 $size" $SCRATCH_MNT/foo \
>> + | _filter_xfs_io | _filter_xfs_io_size_offset 0 $size
>> +$XFS_IO_PROG -c "reflink $SCRATCH_MNT/foo 0 $offset $size" $SCRATCH_MNT/foo \
>> + | _filter_xfs_io | _filter_xfs_io_size_offset $offset $size
>>
>> # Create out second test file which initially, for the first send operation,
>> # only has a single extent that is not shared.
>> -$XFS_IO_PROG -f -c "pwrite -S 0xc7 -b 64K 0 64K" $SCRATCH_MNT/bar \
>> - | _filter_xfs_io
>> +$XFS_IO_PROG -f -c "pwrite -S 0xc7 -b $size 0 $size" $SCRATCH_MNT/bar \
>> + | _filter_xfs_io | _filter_xfs_io_size_offset 0 $size
>>
>> _btrfs subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/base
>>
>> @@ -56,8 +64,8 @@ $BTRFS_UTIL_PROG send -f $send_files_dir/1.snap $SCRATCH_MNT/base 2>&1 \
>> # Now clone the existing extent in file bar to itself at a different offset.
>> # We want to verify the incremental send operation below will issue a clone
>> # operation instead of a write operation.
>> -$XFS_IO_PROG -c "reflink $SCRATCH_MNT/bar 0 64K 64K" $SCRATCH_MNT/bar \
>> - | _filter_xfs_io
>> +$XFS_IO_PROG -c "reflink $SCRATCH_MNT/bar 0 $offset $size" $SCRATCH_MNT/bar \
>> + | _filter_xfs_io | _filter_xfs_io_size_offset $offset $size
>>
>> _btrfs subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/incr
>>
>> diff --git a/tests/btrfs/200.out b/tests/btrfs/200.out
>> index 306d9b24..4a10e506 100644
>> --- a/tests/btrfs/200.out
>> +++ b/tests/btrfs/200.out
>> @@ -1,12 +1,12 @@
>> QA output created by 200
>> -wrote 65536/65536 bytes at offset 0
>> +wrote SIZE/SIZE bytes at offset OFFSET
>> XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>> -linked 65536/65536 bytes at offset 65536
>> +linked SIZE/SIZE bytes at offset OFFSET
>> XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>> -wrote 65536/65536 bytes at offset 0
>> +wrote SIZE/SIZE bytes at offset OFFSET
>> XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>> At subvol SCRATCH_MNT/base
>> -linked 65536/65536 bytes at offset 65536
>> +linked SIZE/SIZE bytes at offset OFFSET
>> XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>> At subvol SCRATCH_MNT/incr
>> At subvol base
>> --
>> 2.34.1
>>
--
Nirjhar Roy
Linux Kernel Developer
IBM, Bangalore