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
34 _require_test_program "feature"
35 _require_test_program "t_mmap_dio"
36 _require_xfs_io_command "chattr" "x"
37 _require_xfs_io_command "falloc"
41 rm -f $SCRATCH_MNT/tf_{s,d}
43 $XFS_IO_PROG -f -c "falloc 0 $tsize" \
44 $SCRATCH_MNT/tf_{s,d} >> $seqres.full 2>&1
50 $XFS_IO_PROG -c "chattr +x" $SCRATCH_MNT/tf_{s,d}
52 src/t_mmap_dio $SCRATCH_MNT/tf_{s,d} $1 "dio both dax"
55 $XFS_IO_PROG -c "chattr +x" $SCRATCH_MNT/tf_{s,d}
56 # again with buffered IO
57 src/t_mmap_dio -b $SCRATCH_MNT/tf_{s,d} \
58 $1 "buffered both dax"
64 $XFS_IO_PROG -c "chattr -x" $SCRATCH_MNT/tf_s
65 $XFS_IO_PROG -c "chattr +x" $SCRATCH_MNT/tf_d
66 src/t_mmap_dio $SCRATCH_MNT/tf_{s,d} \
67 $1 "dio nondax to dax"
70 $XFS_IO_PROG -c "chattr -x" $SCRATCH_MNT/tf_s
71 $XFS_IO_PROG -c "chattr +x" $SCRATCH_MNT/tf_d
72 src/t_mmap_dio -b $SCRATCH_MNT/tf_{s,d} \
73 $1 "buffered nondax to 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 dax to nondax"
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 dax to nondax"
94 $XFS_IO_PROG -c "chattr -x" $SCRATCH_MNT/tf_{s,d}
95 src/t_mmap_dio $SCRATCH_MNT/tf_{s,d} \
99 $XFS_IO_PROG -c "chattr -x" $SCRATCH_MNT/tf_{s,d}
100 src/t_mmap_dio -b $SCRATCH_MNT/tf_{s,d} \
101 $1 "buffered both nondax"
104 # $1 mmap read/write size
105 t_dax_flag_mmap_dio()
115 # less than page size
116 t_dax_flag_mmap_dio 1024
118 t_dax_flag_mmap_dio `src/feature -s`
119 # bigger sizes, for PMD faults
120 t_dax_flag_mmap_dio $((16 * 1024 * 1024))
121 t_dax_flag_mmap_dio $((64 * 1024 * 1024))
124 # make xfs 2Mb aligned for PMD fault testing
125 _scratch_mkfs "-d su=2m,sw=1" > /dev/null 2>&1
127 # mount with dax option
128 _scratch_mount "-o dax"
130 tsize=$((128 * 1024 * 1024))
135 # mount again without dax option
136 export MOUNT_OPTIONS=""
141 echo "Silence is golden"