From: Zorro Lang <zlang@redhat.com>
To: fstests@vger.kernel.org
Subject: [PATCH] xfs/196: fallback to fail_writes for old kernel
Date: Wed, 24 May 2017 22:52:58 +0800 [thread overview]
Message-ID: <1495637578-5255-1-git-send-email-zlang@redhat.com> (raw)
linux XFS rename all "fail_writes" references to "drop_writes" in
v4.11. Some old kernel still use the name "fail_writes", e.g.
RHEL-7. For testing on old kernel, we need to fallback to
"fail_writes".
Signed-off-by: Zorro Lang <zlang@redhat.com>
---
tests/xfs/196 | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/tests/xfs/196 b/tests/xfs/196
index b7d327e..e9b0649 100755
--- a/tests/xfs/196
+++ b/tests/xfs/196
@@ -53,7 +53,13 @@ rm -f $seqres.full
_supported_fs generic
_supported_os Linux
_require_scratch
-_require_xfs_sysfs $(_short_dev $TEST_DEV)/drop_writes
+
+DROP_WRITES="drop_writes"
+# replace "drop_writes" with "fail_writes" for old kernel
+if [ -f /sys/fs/xfs/$(_short_dev $TEST_DEV)/fail_writes ];then
+ DROP_WRITES="fail_writes"
+fi
+_require_xfs_sysfs $(_short_dev $TEST_DEV)/${DROP_WRITES}
_scratch_mkfs >/dev/null 2>&1
_scratch_mount
@@ -66,7 +72,7 @@ bytes=$((64 * 1024))
$XFS_IO_PROG -f -c "pwrite 0 $bytes" $file >> $seqres.full 2>&1
# Enable write drops. All buffered writes are dropped from this point on.
-echo 1 > /sys/fs/xfs/$sdev/drop_writes
+echo 1 > /sys/fs/xfs/$sdev/$DROP_WRITES
# Write every other 4k range to split the larger delalloc extent into many more
# smaller extents. Use pwrite because with write failures enabled, all
@@ -83,7 +89,7 @@ for i in $(seq 4096 8192 $endoff); do
$XFS_IO_PROG -c "pwrite $i 4k" $file >> $seqres.full 2>&1
done
-echo 0 > /sys/fs/xfs/$sdev/drop_writes
+echo 0 > /sys/fs/xfs/$sdev/$DROP_WRITES
_scratch_cycle_mount
$XFS_IO_PROG -c 'bmap -vp' $file | _filter_bmap
@@ -98,9 +104,9 @@ for offset in $(seq 0 100 500); do
$XFS_IO_PROG -fc "pwrite ${offset}m 100m" $file >> $seqres.full 2>&1
punchoffset=$((offset + 75))
- echo 1 > /sys/fs/xfs/$sdev/drop_writes
+ echo 1 > /sys/fs/xfs/$sdev/$DROP_WRITES
$XFS_IO_PROG -c "pwrite ${punchoffset}m 4k" $file >> $seqres.full 2>&1
- echo 0 > /sys/fs/xfs/$sdev/drop_writes
+ echo 0 > /sys/fs/xfs/$sdev/$DROP_WRITES
done
echo "Silence is golden."
--
2.7.4
reply other threads:[~2017-05-24 14:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1495637578-5255-1-git-send-email-zlang@redhat.com \
--to=zlang@redhat.com \
--cc=fstests@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