2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2020 Fujitsu. All Rights Reserved.
7 # By the following cases, verify if statx() can query S_DAX flag
8 # on regular file correctly.
9 # 1) With dax=always option, FS_XFLAG_DAX is ignored and S_DAX flag
10 # always exists on regular file.
11 # 2) With dax=inode option, setting/clearing FS_XFLAG_DAX can change
12 # S_DAX flag on regular file.
13 # 3) With dax=never option, FS_XFLAG_DAX is ignored and S_DAX flag
14 # never exists on regular file.
17 seqres=$RESULT_DIR/$seq
18 echo "QA output created by $seq"
22 status=1 # failure is the default!
23 trap "_cleanup; exit \$status" 0 1 2 3 15
31 # get standard environment, filters and checks
35 # remove previous $seqres.full before test
39 _require_scratch_dax_mountopt "dax=always"
41 _require_xfs_io_command "statx" "-r"
43 PARENT_DIR=$SCRATCH_MNT/testdir
44 TEST_FILE=$PARENT_DIR/testfile
52 # Mount with specified dax option
53 _scratch_mount "$dax_option"
59 $XFS_IO_PROG -c "chattr +x" $PARENT_DIR
61 # Check if setting FS_XFLAG_DAX changes S_DAX flag
62 _check_s_dax $TEST_FILE $exp_s_dax1
65 $XFS_IO_PROG -c "chattr -x" $PARENT_DIR
67 # Check if clearing FS_XFLAG_DAX changes S_DAX flag
68 _check_s_dax $TEST_FILE $exp_s_dax2
75 _scratch_mkfs >> $seqres.full 2>&1
77 # Mount with specified dax option
78 test_s_dax "-o dax=always" 1 1
79 test_s_dax "-o dax=never" 0 0
80 test_s_dax "-o dax=inode" 1 0
81 # Mount without dax option
82 export MOUNT_OPTIONS=""
89 echo "Silence is golden"