2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Red Hat, Inc. All Rights Reserved.
7 # test xfs_quota state command
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
15 status=1 # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
24 # get standard environment, filters and checks
29 # remove previous $seqres.full before test
32 # real QA test starts here
34 # Modify as appropriate.
41 # We could test older, non-project capable kernels but keep it simpler;
42 # Only test crc and beyond (but we will test with and without the feature)
48 function option_string()
51 # Treat 3 options as a bit field, prjquota|grpquota|usrquota
53 if [ "$((VAL & 4))" -ne "0" ]; then OPT=prjquota,${OPT}; fi;
54 if [ "$((VAL & 2))" -ne "0" ]; then OPT=grpquota,${OPT}; fi;
55 if [ "$((VAL & 1))" -ne "0" ]; then OPT=usrquota,${OPT}; fi;
59 filter_quota_state() {
60 sed -e 's/Inode: #[0-9]\+/Inode #XXX/g' | _filter_scratch
63 function test_all_state()
65 for I in `seq 0 7`; do
66 OPTIONS=`option_string $I`
67 echo "== Options: $OPTIONS =="
68 # Some combinations won't mount on V4 supers (grp + prj)
69 _qmount_option "$OPTIONS"
70 _try_scratch_mount &>> $seqres.full || continue
71 $XFS_QUOTA_PROG -x -c "state" $SCRATCH_MNT | filter_quota_state
76 echo "==== NO CRC ===="
77 # Control size to control inode numbers
78 $MKFS_XFS_PROG -f -m crc=0 -n ftype=0 -d size=512m $SCRATCH_DEV >>$seqres.full
82 $MKFS_XFS_PROG -f -m crc=1 -d size=512m $SCRATCH_DEV >>$seqres.full