4 # Simple quota accounting test for direct/buffered/mmap IO.
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2009 Eric Sandeen. All Rights Reserved.
10 # Copyright (c) 2005 Silicon Graphics, Inc. All Rights Reserved.
12 # This program is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU General Public License as
14 # published by the Free Software Foundation.
16 # This program is distributed in the hope that it would be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write the Free Software Foundation,
23 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 #-----------------------------------------------------------------------
28 owner=sandeen@sandeen.net
31 echo "QA output created by $seq"
35 status=1 # failure is the default!
36 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
38 # get standard environment, filters and checks
43 # real QA test starts here
45 _supported_os Linux #IRIX
51 echo; echo "### create files, setting up ownership (type=$type)"
52 rm -f $SCRATCH_MNT/{buffer,direct,mmap}
53 touch $SCRATCH_MNT/{buffer,direct,mmap}
54 chown $uid $SCRATCH_MNT/{buffer,direct,mmap}
55 chgrp $gid $SCRATCH_MNT/{buffer,direct,mmap}
56 for file in $SCRATCH_MNT/{buffer,direct,mmap}; do
57 $here/src/lstat64 $file | head -3 | _filter_scratch
63 echo "### some controlled buffered, direct and mmapd IO (type=$type)"
64 echo "--- initiating parallel IO..." >>$seq.full
65 # Small ios here because ext3 will account for indirect blocks too ...
66 # 48k will fit w/o indirect for 4k blocks (default blocksize)
67 $XFS_IO_PROG -F -c 'pwrite 0 48k' -c 'fsync' \
68 $SCRATCH_MNT/buffer >>$seq.full 2>&1 &
69 $XFS_IO_PROG -F -c 'pwrite 0 48k' -d \
70 $SCRATCH_MNT/direct >>$seq.full 2>&1 &
71 $XFS_IO_PROG -F -c 't 48k' -c 'mm -rw 0 48k' -c 'mw 0 48k' -c 'ms -s' \
72 $SCRATCH_MNT/mmap >>$seq.full 2>&1 &
74 echo "--- completed parallel IO ($type)" >>$seq.full
76 for file in $SCRATCH_MNT/{buffer,direct,mmap}; do
77 $here/src/lstat64 $file | head -3 | _filter_scratch
80 repquota -$type -n $SCRATCH_MNT | grep -v "^#0" | _filter_scratch |
81 awk '/^#/ { if (seen[$1]) next; seen[$1]++; } { print; }'
84 # real QA test starts here
90 umount $SCRATCH_DEV 2>/dev/null
91 _scratch_mkfs >> $seq.full 2>&1
92 _scratch_mount "-o usrquota,grpquota"
93 quotacheck -u -g $SCRATCH_MNT 2>/dev/null
94 quotaon $SCRATCH_MNT 2>/dev/null
97 echo; echo "### test user accounting"
98 export MOUNT_OPTIONS="-o usrquota"
100 quotaon $SCRATCH_MNT 2>/dev/null
104 umount $SCRATCH_DEV 2>/dev/null
106 echo; echo "### test group accounting"
107 export MOUNT_OPTIONS="-o grpquota"
109 quotaon $SCRATCH_MNT 2>/dev/null
113 umount $SCRATCH_DEV 2>/dev/null