btrfs: add test for large direct I/O w/ RAID
authorOmar Sandoval <osandov@fb.com>
Fri, 6 Mar 2020 01:03:12 +0000 (17:03 -0800)
committerEryu Guan <guaneryu@gmail.com>
Sun, 8 Mar 2020 15:39:14 +0000 (23:39 +0800)
Apparently we don't have any tests which exercise the code path in
Btrfs that has to split up direct I/Os for RAID stripes. Add one to
catch the bug fixed by "btrfs: fix RAID direct I/O reads with
alternate csums".

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/btrfs/207 [new file with mode: 0755]
tests/btrfs/207.out [new file with mode: 0644]
tests/btrfs/group

diff --git a/tests/btrfs/207 b/tests/btrfs/207
new file mode 100755 (executable)
index 0000000..d446740
--- /dev/null
@@ -0,0 +1,62 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2020 Facebook.  All Rights Reserved.
+#
+# FS QA Test 207
+#
+# Test large DIO reads and writes with various profiles. Regression test for
+# patch "btrfs: fix RAID direct I/O reads with alternate csums".
+#
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1       # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+       cd /
+       rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+_supported_fs btrfs
+_supported_os Linux
+# we check scratch dev after each loop
+_require_scratch_nocheck
+_require_scratch_dev_pool 4
+_btrfs_get_profile_configs
+
+for mkfs_opts in "${_btrfs_profile_configs[@]}"; do
+       echo "Test $mkfs_opts" >>$seqres.full
+       _scratch_pool_mkfs $mkfs_opts >>$seqres.full 2>&1
+       _scratch_mount >>$seqres.full 2>&1
+
+       dd if=/dev/urandom of="$SCRATCH_MNT/$seq" \
+               bs=1M count=64 conv=fsync status=none
+       dd if="$SCRATCH_MNT/$seq" of="$SCRATCH_MNT/$seq.dioread" \
+               bs=1M iflag=direct status=none
+       dd if="$SCRATCH_MNT/$seq" of="$SCRATCH_MNT/$seq.diowrite" \
+               bs=1M oflag=direct status=none
+       diff -q "$SCRATCH_MNT/$seq" "$SCRATCH_MNT/$seq.dioread" |
+               tee -a $seqres.full
+       diff -q "$SCRATCH_MNT/$seq" "$SCRATCH_MNT/$seq.diowrite" |
+               tee -a $seqres.full
+
+       _scratch_unmount
+       _check_scratch_fs
+done
+
+echo "Silence is golden"
+
+status=0
+exit
diff --git a/tests/btrfs/207.out b/tests/btrfs/207.out
new file mode 100644 (file)
index 0000000..cb8e0e2
--- /dev/null
@@ -0,0 +1,2 @@
+QA output created by 207
+Silence is golden
index e3ad347b25c29168ab09b842f60e8f146373a926..94090758a912427a00e98f138a5aedbdcada2dfa 100644 (file)
 203 auto quick send clone
 204 auto quick punch
 205 auto quick clone compress
-204 auto quick log replay
+206 auto quick log replay
+207 auto rw raid