From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
To: linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org
Cc: Naohiro Aota <naohiro.aota@wdc.com>,
Johannes Thumshirn <johannes.thumshirn@wdc.com>
Subject: [PATCH 2/2] btrfs: require discard functionality from scratch device
Date: Tue, 2 Mar 2021 18:13:05 +0900 [thread overview]
Message-ID: <20210302091305.27828-3-johannes.thumshirn@wdc.com> (raw)
In-Reply-To: <20210302091305.27828-1-johannes.thumshirn@wdc.com>
Some test cases for btrfs require the scratch device to support discard.
Check if the scratch device does support discard before trying to execute
the test.
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
common/rc | 8 ++++++++
tests/btrfs/116 | 1 +
tests/btrfs/156 | 1 +
3 files changed, 10 insertions(+)
diff --git a/common/rc b/common/rc
index 7254130ffe22..9fca7f31d6a2 100644
--- a/common/rc
+++ b/common/rc
@@ -3513,6 +3513,14 @@ _require_batched_discard()
$FSTRIM_PROG $1 > /dev/null 2>&1 || _notrun "FITRIM not supported on $1"
}
+_require_scratch_discard()
+{
+ local sdev="$(_short_dev $SCRATCH_DEV)"
+ local discard=$(cat /sys/block/$sdev/queue/discard_granularity)
+
+ [ $discard -gt 0 ] || _notrun "discard not supported"
+}
+
_require_dumpe2fs()
{
if [ -z "$DUMPE2FS_PROG" ]; then
diff --git a/tests/btrfs/116 b/tests/btrfs/116
index 3ed097eccf03..f4db439caef8 100755
--- a/tests/btrfs/116
+++ b/tests/btrfs/116
@@ -29,6 +29,7 @@ _cleanup()
# real QA test starts here
_supported_fs btrfs
_require_scratch
+_require_scratch_discard
rm -f $seqres.full
diff --git a/tests/btrfs/156 b/tests/btrfs/156
index 89c80e7161e2..56206d99c801 100755
--- a/tests/btrfs/156
+++ b/tests/btrfs/156
@@ -42,6 +42,7 @@ rm -f $seqres.full
_supported_fs btrfs
_require_scratch
_require_fstrim
+_require_scratch_discard
# 1024fs size
fs_size=$((1024 * 1024 * 1024))
--
2.30.0
next prev parent reply other threads:[~2021-03-03 2:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-02 9:13 [PATCH 0/2] fstests: two preperation patches for zoned device support Johannes Thumshirn
2021-03-02 9:13 ` [PATCH 1/2] fstests: add missing checks of fallocate feature Johannes Thumshirn
2021-03-02 19:00 ` Josef Bacik
2021-03-03 6:01 ` Naohiro Aota
2021-03-03 8:04 ` Johannes Thumshirn
2021-03-02 9:13 ` Johannes Thumshirn [this message]
2021-03-02 19:01 ` [PATCH 2/2] btrfs: require discard functionality from scratch device Josef Bacik
2021-03-03 5:58 ` [PATCH 0/2] fstests: two preperation patches for zoned device support Naohiro Aota
2021-03-03 8:04 ` Johannes Thumshirn
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=20210302091305.27828-3-johannes.thumshirn@wdc.com \
--to=johannes.thumshirn@wdc.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=naohiro.aota@wdc.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.