4 # Test per-inode DAX flag by mmap direct/buffered IO.
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
49 _require_test_program "feature"
50 _require_test_program "t_mmap_dio"
51 _require_xfs_io_command "chattr" "+/-x"
52 _require_xfs_io_command "falloc"
56 rm -f $SCRATCH_MNT/tf_{s,d}
58 $XFS_IO_PROG -f -c "falloc 0 $tsize" \
59 $SCRATCH_MNT/tf_{s,d} >> $seqres.full 2>&1
65 $XFS_IO_PROG -c "chattr +x" $SCRATCH_MNT/tf_{s,d}
67 src/t_mmap_dio $SCRATCH_MNT/tf_{s,d} $1 "dio both dax"
70 $XFS_IO_PROG -c "chattr +x" $SCRATCH_MNT/tf_{s,d}
71 # again with buffered IO
72 src/t_mmap_dio -b $SCRATCH_MNT/tf_{s,d} \
73 $1 "buffered both dax"
79 $XFS_IO_PROG -c "chattr -x" $SCRATCH_MNT/tf_s
80 $XFS_IO_PROG -c "chattr +x" $SCRATCH_MNT/tf_d
81 src/t_mmap_dio $SCRATCH_MNT/tf_{s,d} \
82 $1 "dio nondax to dax"
85 $XFS_IO_PROG -c "chattr -x" $SCRATCH_MNT/tf_s
86 $XFS_IO_PROG -c "chattr +x" $SCRATCH_MNT/tf_d
87 src/t_mmap_dio -b $SCRATCH_MNT/tf_{s,d} \
88 $1 "buffered nondax to dax"
94 $XFS_IO_PROG -c "chattr +x" $SCRATCH_MNT/tf_s
95 $XFS_IO_PROG -c "chattr -x" $SCRATCH_MNT/tf_d
96 src/t_mmap_dio $SCRATCH_MNT/tf_{s,d} \
97 $1 "dio dax to nondax"
100 $XFS_IO_PROG -c "chattr +x" $SCRATCH_MNT/tf_s
101 $XFS_IO_PROG -c "chattr -x" $SCRATCH_MNT/tf_d
102 src/t_mmap_dio -b $SCRATCH_MNT/tf_{s,d} \
103 $1 "buffered dax to nondax"
109 $XFS_IO_PROG -c "chattr -x" $SCRATCH_MNT/tf_{s,d}
110 src/t_mmap_dio $SCRATCH_MNT/tf_{s,d} \
114 $XFS_IO_PROG -c "chattr -x" $SCRATCH_MNT/tf_{s,d}
115 src/t_mmap_dio -b $SCRATCH_MNT/tf_{s,d} \
116 $1 "buffered both nondax"
119 # $1 mmap read/write size
120 t_dax_flag_mmap_dio()
130 # less than page size
131 t_dax_flag_mmap_dio 1024
133 t_dax_flag_mmap_dio `src/feature -s`
134 # bigger sizes, for PMD faults
135 t_dax_flag_mmap_dio $((16 * 1024 * 1024))
136 t_dax_flag_mmap_dio $((64 * 1024 * 1024))
139 # make xfs 2Mb aligned for PMD fault testing
140 _scratch_mkfs "-d su=2m,sw=1" > /dev/null 2>&1
142 # mount with dax option
143 _scratch_mount "-o dax"
145 tsize=$((128 * 1024 * 1024))
150 # mount again without dax option
151 export MOUNT_OPTIONS=""
156 echo "Silence is golden"