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
40 _require_scratch_dax_mountopt "dax=always"
42 _require_xfs_io_command "statx" "-r"
44 PARENT_DIR=$SCRATCH_MNT/testdir
45 TEST_FILE=$PARENT_DIR/testfile
53 # Mount with specified dax option
54 _scratch_mount "$dax_option"
60 $XFS_IO_PROG -c "chattr +x" $PARENT_DIR
62 # Check if setting FS_XFLAG_DAX changes S_DAX flag
63 _check_s_dax $TEST_FILE $exp_s_dax1
66 $XFS_IO_PROG -c "chattr -x" $PARENT_DIR
68 # Check if clearing FS_XFLAG_DAX changes S_DAX flag
69 _check_s_dax $TEST_FILE $exp_s_dax2
76 _scratch_mkfs >> $seqres.full 2>&1
78 # Mount with specified dax option
79 test_s_dax "-o dax=always" 1 1
80 test_s_dax "-o dax=never" 0 0
81 test_s_dax "-o dax=inode" 1 0
82 # Mount without dax option
83 export MOUNT_OPTIONS=""
90 echo "Silence is golden"