FS/XFS testing framework
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: linux-btrfs@vger.kernel.org, fstests@vger.kernel.org, kernel-team@fb.com
Subject: [PATCH] fstests: generic/260: don't fail for certain fstrim ops on btrfs
Date: Mon, 22 Nov 2021 17:08:10 -0500	[thread overview]
Message-ID: <175b1ef92bbd2a48e2efb80d0064ca91aab1402e.1637618880.git.josef@toxicpanda.com> (raw)

We have always failed generic/260, because it tests to see if the file
system will reject a trim range that is above the reported fs size.
However for btrfs we will happily remap logical byte offsets within the
file system, so you can end up with bye offsets past the end of the
reported end of the file system.  Thus we do not fail these weird
ranges.  We also don't have the concept of allocation groups, so the
other test that tries to catch overflow doesn't apply to us either.  Fix
this by simply using an offset that will fail (once a related kernel
path is applied) for btrfs.  This will allow us to test the different
overflow cases that do apply to btrfs, and not muddy up test results by
giving us a false negative for the cases that do not apply to btrfs.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 tests/generic/260 | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tests/generic/260 b/tests/generic/260
index b15b4e57..b4d72e0f 100755
--- a/tests/generic/260
+++ b/tests/generic/260
@@ -31,6 +31,7 @@ fssize=$($DF_PROG -k | grep "$SCRATCH_MNT" | grep "$SCRATCH_DEV"  | awk '{print
 
 beyond_eofs=$(_math "$fssize*2048")
 max_64bit=$(_math "2^64 - 1")
+[ $FSTYP == "btrfs" ] && beyond_eofs=$max_64bit
 
 # All these tests should return EINVAL
 # since the start is beyond the end of
@@ -128,6 +129,12 @@ case $FSTYP in
 		len=$start
 		export MKFS_OPTIONS="-f -d agsize=$(_math "$agsize*$bsize") -b size=$bsize"
 		;;
+	btrfs)
+		# Btrfs doesn't care about any of this, just test max_64bit
+		# since it'll fail
+		start=$max_64bit
+		len=$(_math "$start / 2")
+		;;
 	*)
 		# (2^32-1) * 4096 * 65536 == 32bit max size * block size * ag size
 		start=$(_math "(2^32 - 1) * 4096 * 65536")
-- 
2.26.3


             reply	other threads:[~2021-11-22 22:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-22 22:08 Josef Bacik [this message]
2021-11-28 15:19 ` [PATCH] fstests: generic/260: don't fail for certain fstrim ops on btrfs Eryu Guan
2021-11-29 19:32   ` David Sterba

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=175b1ef92bbd2a48e2efb80d0064ca91aab1402e.1637618880.git.josef@toxicpanda.com \
    --to=josef@toxicpanda.com \
    --cc=fstests@vger.kernel.org \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.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