2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Red Hat Inc. All Rights Reserved.
7 # mmap direct/buffered io between DAX and non-DAX mountpoints.
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
15 status=1 # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
24 # get standard environment, filters and checks
28 # remove previous $seqres.full before test
35 _require_test_program "feature"
36 _require_test_program "t_mmap_dio"
37 _require_xfs_io_command "falloc"
41 rm -f $SCRATCH_MNT/tf_{s,d}
42 rm -f $TEST_DIR/tf_{s,d}
44 $XFS_IO_PROG -f -c "falloc 0 $tsize" \
45 $SCRATCH_MNT/tf_{s,d} >> $seqres.full 2>&1
46 $XFS_IO_PROG -f -c "falloc 0 $tsize" \
47 $TEST_DIR/tf_{s,d} >> $seqres.full 2>&1
54 $here/src/t_mmap_dio $SCRATCH_MNT/tf_{s,d} $1 "dio both dax"
57 # again with buffered IO
58 $here/src/t_mmap_dio -b $SCRATCH_MNT/tf_{s,d} \
59 $1 "buffered both dax"
65 $here/src/t_mmap_dio $TEST_DIR/tf_s \
66 $SCRATCH_MNT/tf_d $1 "dio nondax to dax"
69 $here/src/t_mmap_dio -b $TEST_DIR/tf_s \
70 $SCRATCH_MNT/tf_d $1 "buffered nondax to dax"
76 $here/src/t_mmap_dio $SCRATCH_MNT/tf_s \
77 $TEST_DIR/tf_d $1 "dio dax to nondax"
80 $here/src/t_mmap_dio -b $SCRATCH_MNT/tf_s \
81 $TEST_DIR/tf_d $1 "buffered dax to nondax"
87 $here/src/t_mmap_dio $TEST_DIR/tf_{s,d} $1 "dio both nondax"
90 $here/src/t_mmap_dio -b $TEST_DIR/tf_{s,d} \
91 $1 "buffered both nondax"
94 # $1 mmap read/write size
105 # less than page size
108 t_mmap_dio_dax `$here/src/feature -s`
109 # bigger sizes, for PMD faults
110 t_mmap_dio_dax $((16 * 1024 * 1024))
111 t_mmap_dio_dax $((64 * 1024 * 1024))
114 # make fs 2Mb aligned for PMD fault testing
116 if [ "$FSTYP" == "ext4" ]; then
117 mkfs_opts="-E stride=512,stripe_width=1"
118 elif [ "$FSTYP" == "xfs" ]; then
119 mkfs_opts="-d su=2m,sw=1"
121 _scratch_mkfs "$mkfs_opts" > /dev/null 2>&1
123 # mount SCRATCH_DEV with dax option, TEST_DEV not
124 export MOUNT_OPTIONS=""
125 export TEST_FS_MOUNT_OPTS=""
127 _fs_options $TEST_DEV | grep -qw "dax" && \
128 _notrun "we need $TEST_DEV mount without dax"
129 _scratch_mount "-o dax"
131 tsize=$((128 * 1024 * 1024))
136 echo "Silence is golden"