2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2017 SUSE Linux Products GmbH. All Rights Reserved.
5 # FS QA Test No. btrfs/148
7 # Test that direct IO writes work on RAID5 and RAID6 filesystems.
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
14 status=1 # failure is the default!
15 trap "_cleanup; exit \$status" 0 1 2 3 15
23 # get standard environment, filters and checks
27 # real QA test starts here
31 _require_scratch_dev_pool 4
33 _require_btrfs_fs_feature raid56
35 _scratch_dev_pool_get 4
39 test_direct_io_write()
43 _scratch_pool_mkfs $mkfs_options >>$seqres.full 2>&1
46 $XFS_IO_PROG -f -d -c "pwrite -S 0xab 0 1M" $SCRATCH_MNT/foo \
49 # Now read back the same data, we expect to get what we wrote before.
50 echo "File data after direct IO write:"
51 od -t x1 $SCRATCH_MNT/foo | _filter_scratch
53 echo "File data after umounting and mounting again the filesystem:"
54 od -t x1 $SCRATCH_MNT/foo | _filter_scratch
56 $BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
58 echo "Scrub found errors" | tee -a $seqres.full
64 echo "Testing RAID5..."
65 test_direct_io_write "-m raid5 -d raid5"
66 echo "Testing RAID6..."
67 test_direct_io_write "-m raid6 -d raid6"