public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Nirjhar Roy (IBM)" <nirjhar.roy.lists@gmail.com>
To: fstests@vger.kernel.org
Cc: linux-btrfs@vger.kernel.org, ritesh.list@gmail.com,
	ojaswin@linux.ibm.com, djwong@kernel.org, zlang@kernel.org,
	fdmanana@kernel.org, nirjhar.roy.lists@gmail.com
Subject: [PATCH 4/7] btrfs/200: Make this test scale with the block size
Date: Tue, 29 Jul 2025 06:21:47 +0000	[thread overview]
Message-ID: <ec81b0ed49ebfe203d7923f3886776fb74fbaf32.1753769382.git.nirjhar.roy.lists@gmail.com> (raw)
In-Reply-To: <cover.1753769382.git.nirjhar.roy.lists@gmail.com>

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@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


  parent reply	other threads:[~2025-07-29  6:24 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-29  6:21 [PATCH 0/7] btrfs: Misc test fixes for large block/node sizes Nirjhar Roy (IBM)
2025-07-29  6:21 ` [PATCH 1/7] common/filter: Add a helper function to filter offsets and sizes Nirjhar Roy (IBM)
2025-07-29  6:21 ` [PATCH 2/7] common/btrfs: Add a helper function to get the nodesize Nirjhar Roy (IBM)
2025-07-29  6:21 ` [PATCH 3/7] btrfs/137: Make this compatible with all block sizes Nirjhar Roy (IBM)
2025-08-04  3:58   ` Qu Wenruo
2025-08-05  9:41     ` Ojaswin Mujoo
2025-08-05  9:44       ` Qu Wenruo
2025-08-05 12:39         ` Ojaswin Mujoo
2025-08-05 10:47       ` Filipe Manana
2025-08-12  6:23         ` Nirjhar Roy (IBM)
2025-08-12  6:22     ` Nirjhar Roy (IBM)
2025-07-29  6:21 ` Nirjhar Roy (IBM) [this message]
2025-07-29  6:53   ` [PATCH 4/7] btrfs/200: Make this test scale with the block size Filipe Manana
2025-08-12  6:26     ` Nirjhar Roy (IBM)
2025-08-04  4:19   ` Qu Wenruo
2025-07-29  6:21 ` [PATCH 5/7] generic/563: Increase the write tolerance to 6% for larger nodesize Nirjhar Roy (IBM)
2025-07-29  7:45   ` Christoph Hellwig
2025-08-04  7:18     ` Nirjhar Roy (IBM)
2025-07-30 15:06   ` Filipe Manana
2025-08-04  7:18     ` Nirjhar Roy (IBM)
2025-08-04  4:28   ` Qu Wenruo
2025-08-12  6:27     ` Nirjhar Roy (IBM)
2025-07-29  6:21 ` [PATCH 6/7] btrfs/301: Make this test compatible with all block sizes Nirjhar Roy (IBM)
2025-08-04  4:32   ` Qu Wenruo
2025-08-12  6:30     ` Nirjhar Roy (IBM)
2025-07-29  6:21 ` [PATCH 7/7] generic/274: Make the test compatible with all blocksizes Nirjhar Roy (IBM)
2025-08-04  4:35   ` Qu Wenruo
2025-08-12  6:30     ` 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=ec81b0ed49ebfe203d7923f3886776fb74fbaf32.1753769382.git.nirjhar.roy.lists@gmail.com \
    --to=nirjhar.roy.lists@gmail.com \
    --cc=djwong@kernel.org \
    --cc=fdmanana@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=ojaswin@linux.ibm.com \
    --cc=ritesh.list@gmail.com \
    --cc=zlang@kernel.org \
    /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