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