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 _begin_fstest auto attr quick dax
19 # Import common functions.
23 _require_scratch_dax_mountopt "dax=always"
25 _require_xfs_io_command "statx" "-r"
27 PARENT_DIR=$SCRATCH_MNT/testdir
28 TEST_FILE=$PARENT_DIR/testfile
36 # Mount with specified dax option
37 _scratch_mount "$dax_option"
43 $XFS_IO_PROG -c "chattr +x" $PARENT_DIR
45 # Check if setting FS_XFLAG_DAX changes S_DAX flag
46 _check_s_dax $TEST_FILE $exp_s_dax1
49 $XFS_IO_PROG -c "chattr -x" $PARENT_DIR
51 # Check if clearing FS_XFLAG_DAX changes S_DAX flag
52 _check_s_dax $TEST_FILE $exp_s_dax2
59 _scratch_mkfs >> $seqres.full 2>&1
61 # Mount with specified dax option
62 test_s_dax "-o dax=always" 1 1
63 test_s_dax "-o dax=never" 0 0
64 test_s_dax "-o dax=inode" 1 0
65 # Mount without dax option
66 export MOUNT_OPTIONS=""
73 echo "Silence is golden"