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
30 _require_scratch_dev_pool 4
32 _require_btrfs_fs_feature raid56
34 _scratch_dev_pool_get 4
38 test_direct_io_write()
42 _scratch_pool_mkfs $mkfs_options >>$seqres.full 2>&1
45 $XFS_IO_PROG -f -d -c "pwrite -S 0xab 0 1M" $SCRATCH_MNT/foo \
48 # Now read back the same data, we expect to get what we wrote before.
49 echo "File data after direct IO write:"
50 od -t x1 $SCRATCH_MNT/foo | _filter_scratch
52 echo "File data after umounting and mounting again the filesystem:"
53 od -t x1 $SCRATCH_MNT/foo | _filter_scratch
55 $BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
57 echo "Scrub found errors" | tee -a $seqres.full
63 echo "Testing RAID5..."
64 test_direct_io_write "-m raid5 -d raid5"
65 echo "Testing RAID6..."
66 test_direct_io_write "-m raid6 -d raid6"