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 _begin_fstest quota auto quick
12 # Import common functions.
16 # real QA test starts here
23 echo; echo "### create files, setting up ownership (type=$type)"
24 rm -f $SCRATCH_MNT/{buffer,direct,mmap}
25 $XFS_IO_PROG -fc "chproj $prid" $SCRATCH_MNT/{buffer,direct,mmap}
26 chown $uid $SCRATCH_MNT/{buffer,direct,mmap}
27 chgrp $gid $SCRATCH_MNT/{buffer,direct,mmap}
28 for file in $SCRATCH_MNT/{buffer,direct,mmap}; do
29 $here/src/lstat64 $file | head -3 | _filter_scratch
30 $XFS_IO_PROG -c lsproj $file
36 echo "### some controlled buffered, direct and mmapd IO (type=$type)"
37 echo "--- initiating parallel IO..." >>$seqres.full
38 $XFS_IO_PROG -c 'pwrite -b 1m 0 16m' -c 'fsync' \
39 $SCRATCH_MNT/buffer >>$seqres.full 2>&1 &
40 $XFS_IO_PROG -c 'pwrite -b 1m 0 16m' -d \
41 $SCRATCH_MNT/direct >>$seqres.full 2>&1 &
42 $XFS_IO_PROG -c 't 16m' -c 'mm -rw 0 16m' -c 'mw 0 16m' -c 'ms -s' \
43 $SCRATCH_MNT/mmap >>$seqres.full 2>&1 &
45 echo "--- completed parallel IO ($type)" >>$seqres.full
47 for file in $SCRATCH_MNT/{buffer,direct,mmap}; do
48 $here/src/lstat64 $file | head -3 | _filter_scratch
50 xfs_quota -c "quota -hnb -$type $id" $QARGS | _filter_quota
51 xfs_quota -c "quota -hni -$type $id" $QARGS | _filter_quota
52 xfs_quota -c "quota -hnr -$type $id" $QARGS | _filter_quota
55 export MOUNT_OPTIONS="-opquota"
56 _scratch_mkfs_xfs >> $seqres.full
58 _require_prjquota $SCRATCH_DEV
60 # real QA test starts here
61 rm -f $tmp.projects $seqres.full
62 _scratch_unmount 2>/dev/null
63 _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
64 cat $tmp.mkfs >>$seqres.full
70 export QARGS="-x -D /dev/null -P /dev/null $SCRATCH_MNT"
73 echo; echo "### test user accounting"
74 export MOUNT_OPTIONS="-ouquota"
80 _scratch_unmount 2>/dev/null
82 echo; echo "### test group accounting"
83 export MOUNT_OPTIONS="-ogquota"
89 _scratch_unmount 2>/dev/null
91 #echo; echo "### test project accounting"
92 export MOUNT_OPTIONS="-opquota"
98 _scratch_unmount 2>/dev/null