2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2005 Silicon Graphics, Inc. All Rights Reserved.
7 # Simple quota accounting test for direct/buffered/mmap IO.
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
15 status=1 # failure is the default!
16 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
18 # get standard environment, filters and checks
23 # real QA test starts here
31 echo; echo "### create files, setting up ownership (type=$type)"
32 rm -f $SCRATCH_MNT/{buffer,direct,mmap}
33 $XFS_IO_PROG -fc "chproj $prid" $SCRATCH_MNT/{buffer,direct,mmap}
34 chown $uid $SCRATCH_MNT/{buffer,direct,mmap}
35 chgrp $gid $SCRATCH_MNT/{buffer,direct,mmap}
36 for file in $SCRATCH_MNT/{buffer,direct,mmap}; do
37 $here/src/lstat64 $file | head -3 | _filter_scratch
38 $XFS_IO_PROG -c lsproj $file
44 echo "### some controlled buffered, direct and mmapd IO (type=$type)"
45 echo "--- initiating parallel IO..." >>$seqres.full
46 $XFS_IO_PROG -c 'pwrite -b 1m 0 16m' -c 'fsync' \
47 $SCRATCH_MNT/buffer >>$seqres.full 2>&1 &
48 $XFS_IO_PROG -c 'pwrite -b 1m 0 16m' -d \
49 $SCRATCH_MNT/direct >>$seqres.full 2>&1 &
50 $XFS_IO_PROG -c 't 16m' -c 'mm -rw 0 16m' -c 'mw 0 16m' -c 'ms -s' \
51 $SCRATCH_MNT/mmap >>$seqres.full 2>&1 &
53 echo "--- completed parallel IO ($type)" >>$seqres.full
55 for file in $SCRATCH_MNT/{buffer,direct,mmap}; do
56 $here/src/lstat64 $file | head -3 | _filter_scratch
58 xfs_quota -c "quota -hnb -$type $id" $QARGS | _filter_quota
59 xfs_quota -c "quota -hni -$type $id" $QARGS | _filter_quota
60 xfs_quota -c "quota -hnr -$type $id" $QARGS | _filter_quota
63 export MOUNT_OPTIONS="-opquota"
65 _require_prjquota $SCRATCH_DEV
67 # real QA test starts here
68 rm -f $tmp.projects $seqres.full
69 _scratch_unmount 2>/dev/null
70 _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
71 cat $tmp.mkfs >>$seqres.full
77 export QARGS="-x -D /dev/null -P /dev/null $SCRATCH_MNT"
80 echo; echo "### test user accounting"
81 export MOUNT_OPTIONS="-ouquota"
87 _scratch_unmount 2>/dev/null
89 echo; echo "### test group accounting"
90 export MOUNT_OPTIONS="-ogquota"
96 _scratch_unmount 2>/dev/null
98 #echo; echo "### test project accounting"
99 export MOUNT_OPTIONS="-opquota"
105 _scratch_unmount 2>/dev/null