blob: e066d93aca3b77767e065a507ab44736cc607083 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2020 Fujitsu. All Rights Reserved.
#
# FS QA Test 606
#
# By the following cases, verify if statx() can query S_DAX flag
# on regular file correctly.
# 1) With dax=always option, FS_XFLAG_DAX is ignored and S_DAX flag
# always exists on regular file.
# 2) With dax=inode option, setting/clearing FS_XFLAG_DAX can change
# S_DAX flag on regular file.
# 3) With dax=never option, FS_XFLAG_DAX is ignored and S_DAX flag
# never exists on regular file.
#
. ./common/preamble
_begin_fstest auto attr quick dax
# Import common functions.
. ./common/filter
_supported_fs generic
_require_scratch_dax_mountopt "dax=always"
_require_dax_iflag
_require_xfs_io_command "statx" "-r"
PARENT_DIR=$SCRATCH_MNT/testdir
TEST_FILE=$PARENT_DIR/testfile
test_s_dax()
{
local dax_option=$1
local exp_s_dax1=$2
local exp_s_dax2=$3
# Mount with specified dax option
_scratch_mount "$dax_option"
# Prepare directory
mkdir -p $PARENT_DIR
rm -f $TEST_FILE
$XFS_IO_PROG -c "chattr +x" $PARENT_DIR
touch $TEST_FILE
# Check if setting FS_XFLAG_DAX changes S_DAX flag
_check_s_dax $TEST_FILE $exp_s_dax1
rm -f $TEST_FILE
$XFS_IO_PROG -c "chattr -x" $PARENT_DIR
touch $TEST_FILE
# Check if clearing FS_XFLAG_DAX changes S_DAX flag
_check_s_dax $TEST_FILE $exp_s_dax2
_scratch_unmount
}
do_tests()
{
_scratch_mkfs >> $seqres.full 2>&1
# Mount with specified dax option
test_s_dax "-o dax=always" 1 1
test_s_dax "-o dax=never" 0 0
test_s_dax "-o dax=inode" 1 0
# Mount without dax option
export MOUNT_OPTIONS=""
test_s_dax "" 1 0
}
do_tests
# success, all done
echo "Silence is golden"
status=0
exit
|