2 # FS QA Test No. btrfs/148
4 # Test that direct IO writes work on RAID5 and RAID6 filesystems.
6 #-----------------------------------------------------------------------
8 # Copyright (C) 2017 SUSE Linux Products GmbH. All Rights Reserved.
9 # Author: Filipe Manana <fdmanana@suse.com>
11 # This program is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU General Public License as
13 # published by the Free Software Foundation.
15 # This program is distributed in the hope that it would be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write the Free Software Foundation,
22 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #-----------------------------------------------------------------------
27 seqres=$RESULT_DIR/$seq
28 echo "QA output created by $seq"
31 status=1 # failure is the default!
32 trap "_cleanup; exit \$status" 0 1 2 3 15
40 # get standard environment, filters and checks
44 # real QA test starts here
48 _require_scratch_dev_pool 4
51 _scratch_dev_pool_get 4
55 test_direct_io_write()
59 _scratch_pool_mkfs $mkfs_options >>$seqres.full 2>&1
62 $XFS_IO_PROG -f -d -c "pwrite -S 0xab 0 1M" $SCRATCH_MNT/foo \
65 # Now read back the same data, we expect to get what we wrote before.
66 echo "File data after direct IO write:"
67 od -t x1 $SCRATCH_MNT/foo | _filter_scratch
69 echo "File data after umounting and mounting again the filesystem:"
70 od -t x1 $SCRATCH_MNT/foo | _filter_scratch
72 $BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
74 echo "Scrub found errors" | tee -a $seqres.full
80 echo "Testing RAID5..."
81 test_direct_io_write "-m raid5 -d raid5"
82 echo "Testing RAID6..."
83 test_direct_io_write "-m raid6 -d raid6"