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