From: Anand Jain <anand.jain@oracle.com>
To: fstests@vger.kernel.org
Cc: linux-btrfs@vger.kernel.org
Subject: [PATCH 2/4] btrfs/220: discard=sync support older kernel
Date: Fri, 13 Aug 2021 09:59:33 +0800 [thread overview]
Message-ID: <7f0731e5ed53fdd5b51ff1f2e51492415a46732a.1628818510.git.anand.jain@oracle.com> (raw)
In-Reply-To: <cover.1628818510.git.anand.jain@oracle.com>
mount option -o discard=sync isn't supported on the older kernel, make
this test case older kernel compatible by checking if the mount option
is supported.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
tests/btrfs/220 | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/tests/btrfs/220 b/tests/btrfs/220
index 7207c6967793..a01b28a6e42f 100755
--- a/tests/btrfs/220
+++ b/tests/btrfs/220
@@ -263,9 +263,14 @@ test_revertible_options()
test_roundtrip_mount "nodatasum" "nodatasum" "datasum" "$DEFAULT_OPTS"
test_should_fail "discard=invalid"
- test_roundtrip_mount "discard" "discard" "discard=sync" "discard"
- test_roundtrip_mount "discard=async" "discard=async" "discard=sync" "discard"
- test_roundtrip_mount "discard=sync" "discard" "nodiscard" "$DEFAULT_OPTS"
+ if [ "$enable_discard_sync" = true ]; then
+ test_roundtrip_mount "discard" "discard" "discard=sync" "discard"
+ test_roundtrip_mount "discard=async" "discard=async" "discard=sync" "discard"
+ test_roundtrip_mount "discard=sync" "discard" "nodiscard" "$DEFAULT_OPTS"
+ else
+ test_roundtrip_mount "discard" "discard" "discard" "discard"
+ test_roundtrip_mount "discard" "discard" "nodiscard" "$DEFAULT_OPTS"
+ fi
test_roundtrip_mount "enospc_debug" "enospc_debug" "noenospc_debug" "$DEFAULT_OPTS"
@@ -292,6 +297,13 @@ test_revertible_options()
test_roundtrip_mount "notreelog" "notreelog" "treelog" "$DEFAULT_OPTS"
}
+# Find out if the running kernel supports the -o discard=sync option.
+_scratch_mkfs >/dev/null
+MOUNT_OPTIONS=
+enable_discard_sync=false
+_try_scratch_mount "-o discard=sync" > /dev/null 2>&1 && \
+ { enable_discard_sync=true; _scratch_unmount; }
+
# real QA test starts here
_scratch_mkfs >/dev/null
--
2.27.0
next prev parent reply other threads:[~2021-08-13 1:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-13 1:59 [PATCH 0/4] btrfs/220: make it compatible with older kernels Anand Jain
2021-08-13 1:59 ` [PATCH 1/4] rc: debug add _scratch_mount_options to the _scratch_mount Anand Jain
2021-08-13 1:59 ` Anand Jain [this message]
2021-08-13 1:59 ` [PATCH 3/4] btrfs/220: nologreplay support older kernel Anand Jain
2021-08-13 1:59 ` [PATCH 4/4] btrfs/220: clear_cache fix for " Anand Jain
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=7f0731e5ed53fdd5b51ff1f2e51492415a46732a.1628818510.git.anand.jain@oracle.com \
--to=anand.jain@oracle.com \
--cc=fstests@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).