public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: "Nirjhar Roy (IBM)" <nirjhar.roy.lists@gmail.com>
To: Zorro Lang <zlang@redhat.com>
Cc: fstests@vger.kernel.org, ritesh.list@gmail.com,
	ojaswin@linux.ibm.com, djwong@kernel.org, fdmanana@kernel.org,
	quwenruo.btrfs@gmx.com, zlang@kernel.org
Subject: Re: [PATCH 3/4] btrfs/200: Make the test compatible with all supported block sizes
Date: Tue, 7 Oct 2025 13:58:10 +0530	[thread overview]
Message-ID: <17426fc6-294e-4c14-b2b0-4591c15251e5@gmail.com> (raw)
In-Reply-To: <20250926173815.wmyvfjxckwhnvu3j@dell-per750-06-vm-08.rhts.eng.pek2.redhat.com>


On 9/26/25 23:08, Zorro Lang wrote:
> On Tue, Sep 16, 2025 at 03:30:11PM +0000, Nirjhar Roy (IBM) wrote:
>> This test fails on 64k block size with the following error:
>>
>>       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
>>
>> So, basically after btrfs receive, the file /mnt/scratch/base/foo
>> doesn't have any shared extents in the base snapshot.
>> The reason is that during btrfs send, the extents are not cloned
>> and instead they are written.
>> The following condition is responsible for the above behavior
>>
>> in function clone_range():
>>
>> 	/*
>> 	 * Prevent cloning from a zero offset with a length matching the sector
>> 	 * size because in some scenarios this will make the receiver fail.
>> 	 *
>> 	 * For example, if in the source filesystem the extent at offset 0
>> 	 * has a length of sectorsize and it was written using direct IO, then
>> 	 * it can never be an inline extent (even if compression is enabled).
>> 	 * Then this extent can be cloned in the original filesystem to a non
>> 	 * zero file offset, but it may not be possible to clone in the
>> 	 * destination filesystem because it can be inlined due to compression
>> 	 * on the destination filesystem (as the receiver's write operations are
>> 	 * always done using buffered IO). The same happens when the original
>> 	 * filesystem does not have compression enabled but the destination
>> 	 * filesystem has.
>> 	 */
>> 	if (clone_root->offset == 0 &&
>> 	    len == sctx->send_root->fs_info->sectorsize)
>> 		return send_extent_data(sctx, dst_path, offset, len);
>>
>> Since we are cloning from the first half [0 to 64k), clone_root->offset = 0
>> and len = 64k which is the sectorsize (sctx->send_root->fs_info->sectorsize).
>> Fix this by increasing the file size and offsets to 128k so that
>> len == sctx->send_root->fs_info->sectorsize is not true.
>>
>> Reported-by: Disha Goel <disgoel@linux.ibm.com>
>> Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>
>> ---
>>   tests/btrfs/200     | 8 ++++----
>>   tests/btrfs/200.out | 8 ++++----
>>   2 files changed, 8 insertions(+), 8 deletions(-)
>>
>> diff --git a/tests/btrfs/200 b/tests/btrfs/200
>> index e62937a4..b53955ce 100755
>> --- a/tests/btrfs/200
>> +++ b/tests/btrfs/200
>> @@ -38,14 +38,14 @@ _scratch_mount
>>   # 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 \
>> +$XFS_IO_PROG -f -c "pwrite -S 0xb1 -b 128K 0 128K" $SCRATCH_MNT/foo \
> This change and explanation makes sense to me, and I think 128k won't break
> the "an extent" requirement (compare with 64k). So,
>
> Reviewed-by: Zorro Lang <zlang@redhat.com>

Thank you.

--NR

>>   	| _filter_xfs_io
>> -$XFS_IO_PROG -c "reflink $SCRATCH_MNT/foo 0 64K 64K" $SCRATCH_MNT/foo \
>> +$XFS_IO_PROG -c "reflink $SCRATCH_MNT/foo 0 128K 128K" $SCRATCH_MNT/foo \
>>   	| _filter_xfs_io
>>   
>>   # 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 \
>> +$XFS_IO_PROG -f -c "pwrite -S 0xc7 -b 128K 0 128K" $SCRATCH_MNT/bar \
>>   	| _filter_xfs_io
>>   
>>   _btrfs subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/base
>> @@ -56,7 +56,7 @@ $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 \
>> +$XFS_IO_PROG -c "reflink $SCRATCH_MNT/bar 0 128K 128K" $SCRATCH_MNT/bar \
>>   	| _filter_xfs_io
>>   
>>   _btrfs subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/incr
>> diff --git a/tests/btrfs/200.out b/tests/btrfs/200.out
>> index 306d9b24..a33b3c1e 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 131072/131072 bytes at offset 0
>>   XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>> -linked 65536/65536 bytes at offset 65536
>> +linked 131072/131072 bytes at offset 131072
>>   XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>> -wrote 65536/65536 bytes at offset 0
>> +wrote 131072/131072 bytes at offset 0
>>   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 131072/131072 bytes at offset 131072
>>   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


  reply	other threads:[~2025-10-07  8:28 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-16 15:30 [PATCH 0/4] btrfs: More test fixes for large block/node sizes Nirjhar Roy (IBM)
2025-09-16 15:30 ` [PATCH 1/4] generic/371: Fix the test to be compatible block sizes upto 64k Nirjhar Roy (IBM)
2025-09-26 16:37   ` Zorro Lang
2025-10-21  8:57     ` Nirjhar Roy (IBM)
2025-11-01 11:36       ` Zorro Lang
2025-11-03 15:44         ` Nirjhar Roy (IBM)
2025-11-03 15:45         ` Nirjhar Roy (IBM)
2025-12-15  5:04         ` Nirjhar Roy (IBM)
2026-01-18 18:22           ` Zorro Lang
2026-01-19  5:11             ` Nirjhar Roy (IBM)
2025-10-21  9:00     ` Nirjhar Roy (IBM)
2026-01-21 13:51   ` Zorro Lang
2025-09-16 15:30 ` [PATCH 2/4] generic/562: Make test compatible with block sizes till 64k Nirjhar Roy (IBM)
2025-09-26 16:54   ` Zorro Lang
2025-10-07  8:29     ` Nirjhar Roy (IBM)
2025-10-07 11:18       ` Filipe Manana
2025-10-07 11:22         ` Nirjhar Roy (IBM)
2025-09-16 15:30 ` [PATCH 3/4] btrfs/200: Make the test compatible with all supported block sizes Nirjhar Roy (IBM)
2025-09-26 17:38   ` Zorro Lang
2025-10-07  8:28     ` Nirjhar Roy (IBM) [this message]
2025-10-07 11:19   ` Filipe Manana
2025-09-16 15:30 ` [PATCH 4/4] btrfs/290: " Nirjhar Roy (IBM)
2025-10-07 11:22   ` Filipe Manana
2025-10-07 11:27     ` Nirjhar Roy (IBM)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=17426fc6-294e-4c14-b2b0-4591c15251e5@gmail.com \
    --to=nirjhar.roy.lists@gmail.com \
    --cc=djwong@kernel.org \
    --cc=fdmanana@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=ojaswin@linux.ibm.com \
    --cc=quwenruo.btrfs@gmx.com \
    --cc=ritesh.list@gmail.com \
    --cc=zlang@kernel.org \
    --cc=zlang@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox