2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Red Hat Inc. All Rights Reserved.
7 # Test per-inode DAX flag by mmap direct/buffered IO.
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
32 _require_scratch_dax_mountopt "dax=always"
33 _require_test_program "feature"
34 _require_test_program "t_mmap_dio"
36 _require_xfs_io_command "falloc"
38 SRC_DIR=$SCRATCH_MNT/src
39 SRC_FILE=$SRC_DIR/tf_s
40 DST_DIR=$SCRATCH_MNT/dst
41 DST_FILE=$DST_DIR/tf_d
45 mkdir -p $SRC_DIR $DST_DIR
50 rm -f $SRC_FILE $DST_FILE
51 $XFS_IO_PROG -f -c "falloc 0 $tsize" \
52 $SRC_FILE $DST_FILE >> $seqres.full 2>&1
57 $XFS_IO_PROG -c "chattr +x" $SRC_DIR $DST_DIR
60 $here/src/t_mmap_dio $SRC_FILE $DST_FILE \
64 # again with buffered IO
65 $here/src/t_mmap_dio -b $SRC_FILE $DST_FILE \
66 $1 "buffered both dax"
71 $XFS_IO_PROG -c "chattr -x" $SRC_DIR
72 $XFS_IO_PROG -c "chattr +x" $DST_DIR
74 $here/src/t_mmap_dio $SRC_FILE $DST_FILE \
75 $1 "dio nondax to dax"
78 $here/src/t_mmap_dio -b $SRC_FILE $DST_FILE \
79 $1 "buffered nondax to dax"
84 $XFS_IO_PROG -c "chattr +x" $SRC_DIR
85 $XFS_IO_PROG -c "chattr -x" $DST_DIR
87 $here/src/t_mmap_dio $SRC_FILE $DST_FILE \
88 $1 "dio dax to nondax"
91 $here/src/t_mmap_dio -b $SRC_FILE $DST_FILE \
92 $1 "buffered dax to nondax"
97 $XFS_IO_PROG -c "chattr -x" $SRC_DIR $DST_DIR
99 $here/src/t_mmap_dio $SRC_FILE $DST_FILE \
103 $here/src/t_mmap_dio -b $SRC_FILE $DST_FILE \
104 $1 "buffered both nondax"
107 # $1 mmap read/write size
108 t_dax_flag_mmap_dio()
118 local mount_option=$1
120 _scratch_mount "$mount_option"
123 # less than page size
124 t_dax_flag_mmap_dio 1024
126 t_dax_flag_mmap_dio `$here/src/feature -s`
127 # bigger sizes, for PMD faults
128 t_dax_flag_mmap_dio $((16 * 1024 * 1024))
129 t_dax_flag_mmap_dio $((64 * 1024 * 1024))
134 # make xfs aligned for PMD fault testing
135 _scratch_mkfs_geom $(_get_hugepagesize) 1 >> $seqres.full 2>&1
137 tsize=$((128 * 1024 * 1024))
139 # mount with dax=inode option
140 do_tests "-o dax=inode"
142 # mount without dax option
143 export MOUNT_OPTIONS=""
147 echo "Silence is golden"