4 # mmap direct/buffered io between DAX and non-DAX mountpoints.
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2017 Red Hat Inc. All Rights Reserved.
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation.
13 # This program is distributed in the hope that it would be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write the Free Software Foundation,
20 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #-----------------------------------------------------------------------
25 seqres=$RESULT_DIR/$seq
26 echo "QA output created by $seq"
30 status=1 # failure is the default!
31 trap "_cleanup; exit \$status" 0 1 2 3 15
39 # get standard environment, filters and checks
43 # remove previous $seqres.full before test
50 _require_test_program "feature"
51 _require_test_program "t_mmap_dio"
52 _require_xfs_io_command "falloc"
56 rm -f $SCRATCH_MNT/tf_{s,d}
57 rm -f $TEST_DIR/tf_{s,d}
59 $XFS_IO_PROG -f -c "falloc 0 $tsize" \
60 $SCRATCH_MNT/tf_{s,d} >> $seqres.full 2>&1
61 $XFS_IO_PROG -f -c "falloc 0 $tsize" \
62 $TEST_DIR/tf_{s,d} >> $seqres.full 2>&1
69 src/t_mmap_dio $SCRATCH_MNT/tf_{s,d} $1 "dio both dax"
72 # again with buffered IO
73 src/t_mmap_dio -b $SCRATCH_MNT/tf_{s,d} \
74 $1 "buffered both dax"
80 src/t_mmap_dio $TEST_DIR/tf_s \
81 $SCRATCH_MNT/tf_d $1 "dio nondax to dax"
84 src/t_mmap_dio -b $TEST_DIR/tf_s \
85 $SCRATCH_MNT/tf_d $1 "buffered nondax to dax"
91 src/t_mmap_dio $SCRATCH_MNT/tf_s \
92 $TEST_DIR/tf_d $1 "dio dax to nondax"
95 src/t_mmap_dio -b $SCRATCH_MNT/tf_s \
96 $TEST_DIR/tf_d $1 "buffered dax to nondax"
102 src/t_mmap_dio $TEST_DIR/tf_{s,d} $1 "dio both nondax"
105 src/t_mmap_dio -b $TEST_DIR/tf_{s,d} \
106 $1 "buffered both nondax"
109 # $1 mmap read/write size
120 # less than page size
123 t_mmap_dio_dax `src/feature -s`
124 # bigger sizes, for PMD faults
125 t_mmap_dio_dax $((16 * 1024 * 1024))
126 t_mmap_dio_dax $((64 * 1024 * 1024))
129 # make fs 2Mb aligned for PMD fault testing
131 if [ "$FSTYP" == "ext4" ]; then
132 mkfs_opts="-E stride=512,stripe_width=1"
133 elif [ "$FSTYP" == "xfs" ]; then
134 mkfs_opts="-d su=2m,sw=1"
136 _scratch_mkfs "$mkfs_opts" > /dev/null 2>&1
138 # mount SCRATCH_DEV with dax option, TEST_DEV not
139 export MOUNT_OPTIONS=""
140 export TEST_FS_MOUNT_OPTS=""
142 _fs_options $TEST_DEV | grep -qw "dax" && \
143 _notrun "we need $TEST_DEV mount without dax"
144 _scratch_mount "-o dax"
146 tsize=$((128 * 1024 * 1024))
151 echo "Silence is golden"