4 # Simple quota accounting test for direct/buffered/mmap IO.
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2005 Silicon Graphics, Inc. All Rights Reserved.
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation.
13 # This program is distributed in the hope that it would be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write the Free Software Foundation,
20 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #-----------------------------------------------------------------------
28 echo "QA output created by $seq"
32 status=1 # failure is the default!
33 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
35 # get standard environment, filters and checks
43 s,$SCRATCH_MNT,[SCR_MNT],;
44 s,$SCRATCH_DEV,[SCR_DEV],;
48 # real QA test starts here
50 _supported_os Linux #IRIX
57 echo; echo "### create files, setting up ownership (type=$type)"
58 rm -f $SCRATCH_MNT/{buffer,direct,mmap}
59 $XFS_IO_PROG -fc "chproj $prid" $SCRATCH_MNT/{buffer,direct,mmap}
60 chown $uid $SCRATCH_MNT/{buffer,direct,mmap}
61 chgrp $gid $SCRATCH_MNT/{buffer,direct,mmap}
62 for file in $SCRATCH_MNT/{buffer,direct,mmap}; do
63 $here/src/lstat64 $file | head -3 | filter_scratch
64 $XFS_IO_PROG -c lsproj $file
70 echo "### some controlled buffered, direct and mmapd IO (type=$type)"
71 echo "--- initiating parallel IO..." >>$seq.full
72 $XFS_IO_PROG -c 'pwrite -b 1m 0 16m' -c 'fsync' \
73 $SCRATCH_MNT/buffer >>$seq.full 2>&1 &
74 $XFS_IO_PROG -c 'pwrite -b 1m 0 16m' -d \
75 $SCRATCH_MNT/direct >>$seq.full 2>&1 &
76 $XFS_IO_PROG -c 't 16m' -c 'mm -rw 0 16m' -c 'mw 0 16m' -c 'ms -s' \
77 $SCRATCH_MNT/mmap >>$seq.full 2>&1 &
79 echo "--- completed parallel IO ($type)" >>$seq.full
81 for file in $SCRATCH_MNT/{buffer,direct,mmap}; do
82 $here/src/lstat64 $file | head -3 | filter_scratch
84 xfs_quota -c "quota -hnb -$type $id" $QARGS | filter_scratch
85 xfs_quota -c "quota -hni -$type $id" $QARGS | filter_scratch
86 xfs_quota -c "quota -hnr -$type $id" $QARGS | filter_scratch
89 # real QA test starts here
90 rm -f $tmp.projects $seq.full
91 umount $SCRATCH_DEV 2>/dev/null
92 _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
93 cat $tmp.mkfs >>$seq.full
99 export QARGS="-x -D /dev/null -P /dev/null $SCRATCH_MNT"
102 echo; echo "### test user accounting"
103 export MOUNT_OPTIONS="-ouquota"
109 umount $SCRATCH_DEV 2>/dev/null
111 echo; echo "### test group accounting"
112 export MOUNT_OPTIONS="-ogquota"
118 umount $SCRATCH_DEV 2>/dev/null
120 #echo; echo "### test project accounting"
121 export MOUNT_OPTIONS="-opquota"
127 umount $SCRATCH_DEV 2>/dev/null