2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Facebook. All Rights Reserved.
7 # Test two threads doing non-overlapping direct I/O in the same extents.
8 # Motivated by a bug in Btrfs' direct I/O get_block function which would lead
9 # to spurious -EEXIST failures from direct I/O reads.
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
17 status=1 # failure is the default!
18 trap "_cleanup; exit \$status" 0 1 2 3 15
27 # get standard environment, filters and checks
31 # remove previous $seqres.full before test
34 # real QA test starts here
39 _require_xfs_io_command "falloc"
40 _require_test_program "dio-interleaved"
43 extent_size="$(($(_get_block_size "$TEST_DIR") * 2))"
45 testfile="$TEST_DIR/$$-testfile"
47 $XFS_IO_PROG -fc "truncate 0" "$testfile"
48 for ((off = 0; off < num_extents * extent_size; off += extent_size)); do
49 $XFS_IO_PROG -c "falloc $off $extent_size" "$testfile"
52 # To reproduce the Btrfs bug, the extent map must not be cached in memory.
54 echo 3 > /proc/sys/vm/drop_caches
56 "$here/src/dio-interleaved" "$extent_size" "$num_extents" "$testfile"
58 echo "Silence is golden"