2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Red Hat, Inc. All Rights Reserved.
7 # test xfs_quota state command
10 _begin_fstest auto quick quota
12 # Import common functions.
16 # real QA test starts here
18 # Modify as appropriate.
24 # We could test older, non-project capable kernels but keep it simpler;
25 # Only test crc and beyond (but we will test with and without the feature)
29 function option_string()
32 # Treat 3 options as a bit field, prjquota|grpquota|usrquota
34 if [ "$((VAL & 4))" -ne "0" ]; then OPT=prjquota,${OPT}; fi;
35 if [ "$((VAL & 2))" -ne "0" ]; then OPT=grpquota,${OPT}; fi;
36 if [ "$((VAL & 1))" -ne "0" ]; then OPT=usrquota,${OPT}; fi;
40 filter_quota_state() {
41 sed -e 's/Inode: #[0-9]\+/Inode #XXX/g' \
42 -e '/max warnings:/d' \
43 -e '/Blocks grace time:/d' \
44 -e '/Inodes grace time:/d' \
48 filter_quota_state2() {
49 sed -e '/User quota state on/d' \
50 -e '/ Accounting: /d' \
51 -e '/ Enforcement: /d' \
53 -e '/Blocks max warnings: /d' \
54 -e '/Inodes max warnings: /d' \
58 function test_all_state()
60 for I in `seq 0 7`; do
61 OPTIONS=`option_string $I`
62 echo "== Options: $OPTIONS =="
63 # Some combinations won't mount on V4 supers (grp + prj)
64 _qmount_option "$OPTIONS"
65 _try_scratch_mount &>> $seqres.full || continue
66 $XFS_QUOTA_PROG -x -c "state -u" $SCRATCH_MNT | filter_quota_state
67 $XFS_QUOTA_PROG -x -c "state -g" $SCRATCH_MNT | filter_quota_state
68 $XFS_QUOTA_PROG -x -c "state -p" $SCRATCH_MNT | filter_quota_state
69 $XFS_QUOTA_PROG -x -c "state -u" $SCRATCH_MNT | filter_quota_state2
74 echo "==== NO CRC ===="
75 # Control size to control inode numbers
76 _scratch_mkfs_xfs "-m crc=0 -n ftype=0 -d size=512m" >> $seqres.full
80 _scratch_mkfs_xfs "-m crc=1 -d size=512m" >>$seqres.full