For large block sizes like 64k on powerpc with 64k pagesize it failed because this test was hardcoded to work with 4k blocksize. 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). 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@xxxxxxxxxxxxx> Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@xxxxxxxxx> --- 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