c85e1024229980137423099b622d8eb11f419017
[xfstests-dev.git] / 205
1 #! /bin/sh
2 # FS QA Test No. 205
3 #
4 # Test out ENOSPC flushing on small filesystems.
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2009 Dave Chinner
8 #
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.
12 #
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.
17 #
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
21 #-----------------------------------------------------------------------
22 #
23 # creator
24 owner=david@fromorbit.com
25
26 seq=`basename $0`
27 echo "QA output created by $seq"
28
29 here=`pwd`
30 tmp=/tmp/$$
31 status=1        # failure is the default!
32
33 # get standard environment, filters and checks
34 . ./common.rc
35 . ./common.filter
36
37 # real QA test starts here
38 _supported_fs xfs
39 _supported_os Linux
40
41 _require_scratch
42
43 _scratch_mkfs_xfs -d size=16m -b size=512 >/dev/null
44 _scratch_mount
45
46 # on a 16MB filesystem, there's 32768x512byte blocks. used is:
47 #       - 4944 in the log,
48 #       - 32+1 for the root inode cluster
49 #       - 4 for the AG header
50 #       - 2 for free space btrees
51 #       - 4 for the AGFL
52 #       - min(%5, 1024) = 1024 blocks for the reserve pool
53 #       - about 15 blocks I can't account for right now.
54 # That leaves ~26,745 blocks free to use.
55 #
56 # Writing the following three files fill the fs almost exactly.
57 #
58 # $ df -k /mnt/scratch
59 # Filesystem           1K-blocks      Used Available Use% Mounted on
60 # /dev/ubdc                13912     13908         4 100% /mnt/scratch
61 #
62 dd if=/dev/zero of=$SCRATCH_MNT/fred bs=512 count=25000 2>&1 | _filter_dd
63 dd if=/dev/zero of=$SCRATCH_MNT/fred2 bs=512 count=500 2>&1 | _filter_dd
64 dd if=/dev/zero of=$SCRATCH_MNT/fred3 bs=512 count=245 2>&1 | _filter_dd
65 rm -f $SCRATCH_MNT/fred*
66
67 echo "*** one file"
68 # now try a single file of that size
69 dd if=/dev/zero of=$SCRATCH_MNT/fred bs=512 count=26745 2>&1 | _filter_dd
70 #rm -f $SCRATCH_MNT/fred*
71
72 echo "*** one file, a few bytes at a time"
73 # now try a single file of that size
74 dd if=/dev/zero of=$SCRATCH_MNT/fred bs=15 count=$[26745/15*512] 2>&1 | _filter_dd
75
76 # success, all done
77 echo "*** done"
78 rm -f $seq.full
79 status=0