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
20 _require_xfs_io_command "syncfs"
24 echo; echo "### create files, setting up ownership (type=$type)"
25 rm -f $SCRATCH_MNT/{buffer,direct,mmap}
26 $XFS_IO_PROG -fc "chproj $prid" $SCRATCH_MNT/{buffer,direct,mmap}
27 chown $uid $SCRATCH_MNT/{buffer,direct,mmap}
28 chgrp $gid $SCRATCH_MNT/{buffer,direct,mmap}
29 for file in $SCRATCH_MNT/{buffer,direct,mmap}; do
30 $here/src/lstat64 $file | head -3 | _filter_scratch
31 $XFS_IO_PROG -c lsproj $file
37 echo "### some controlled buffered, direct and mmapd IO (type=$type)"
38 echo "--- initiating parallel IO..." >>$seqres.full
39 $XFS_IO_PROG -c 'pwrite -b 1m 0 16m' -c 'fsync' \
40 $SCRATCH_MNT/buffer >>$seqres.full 2>&1 &
41 $XFS_IO_PROG -c 'pwrite -b 1m 0 16m' -d \
42 $SCRATCH_MNT/direct >>$seqres.full 2>&1 &
43 $XFS_IO_PROG -c 't 16m' -c 'mm -rw 0 16m' -c 'mw 0 16m' -c 'ms -s' \
44 $SCRATCH_MNT/mmap >>$seqres.full 2>&1 &
46 echo "--- completed parallel IO ($type)" >>$seqres.full
48 for file in $SCRATCH_MNT/{buffer,direct,mmap}; do
49 $here/src/lstat64 $file | head -3 | _filter_scratch
51 $XFS_IO_PROG -c syncfs $SCRATCH_MNT
52 $XFS_QUOTA_PROG -c "quota -hnb -$type $id" $QARGS | _filter_quota
53 $XFS_QUOTA_PROG -c "quota -hni -$type $id" $QARGS | _filter_quota
54 $XFS_QUOTA_PROG -c "quota -hnr -$type $id" $QARGS | _filter_quota
57 export MOUNT_OPTIONS="-opquota"
58 _scratch_mkfs_xfs >> $seqres.full
60 _require_prjquota $SCRATCH_DEV
62 # real QA test starts here
63 rm -f $tmp.projects $seqres.full
64 _scratch_unmount 2>/dev/null
65 _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
66 cat $tmp.mkfs >>$seqres.full
72 export QARGS="-x -D /dev/null -P /dev/null $SCRATCH_MNT"
75 echo; echo "### test user accounting"
76 export MOUNT_OPTIONS="-ouquota"
82 _scratch_unmount 2>/dev/null
84 echo; echo "### test group accounting"
85 export MOUNT_OPTIONS="-ogquota"
91 _scratch_unmount 2>/dev/null
93 #echo; echo "### test project accounting"
94 export MOUNT_OPTIONS="-opquota"
100 _scratch_unmount 2>/dev/null