2 # FS QA Test No. generic/027
4 # Run 8 processes writing 1k files to seperate files in seperate dirs to
5 # hit ENOSPC on small fs with little free space. Loop for 100 iterations.
8 # 34cf865 ext4: fix deadlock when writing in ENOSPC conditions
10 #-----------------------------------------------------------------------
11 # Copyright (c) 2014 Red Hat Inc. All Rights Reserved.
13 # This program is free software; you can redistribute it and/or
14 # modify it under the terms of the GNU General Public License as
15 # published by the Free Software Foundation.
17 # This program is distributed in the hope that it would be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write the Free Software Foundation,
24 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 #-----------------------------------------------------------------------
29 seqres=$RESULT_DIR/$seq
30 echo "QA output created by $seq"
34 status=1 # failure is the default!
35 trap "_cleanup; exit \$status" 0 1 2 3 15
50 while $XFS_IO_PROG -f $direct -c "pwrite 0 1k" $dir/file_$i >/dev/null 2>&1; do
55 # get standard environment, filters and checks
59 # real QA test starts here
66 echo "Silence is golden"
68 _scratch_mkfs_sized $((256 * 1024 * 1024)) >>$seqres.full 2>&1
71 echo "Reserve 2M space" >>$seqres.full
72 $XFS_IO_PROG -f -c "pwrite 0 2m" $SCRATCH_MNT/testfile >>$seqres.full 2>&1
73 echo "Fulfill the fs" >>$seqres.full
74 $XFS_IO_PROG -f -c "pwrite 0 254m" $SCRATCH_MNT/bigfile >>$seqres.full 2>&1
75 echo "Remove reserved file" >>$seqres.full
76 rm -f $SCRATCH_MNT/testfile
79 # btrfs takes much longer time, reduce the loop count
80 if [ "$FSTYP" == "btrfs" ]; then
84 dir=$SCRATCH_MNT/testdir
85 echo -n "iteration" >>$seqres.full
87 while [ $i -le $loop ]; do
88 echo -n " $i" >>$seqres.full
90 while [ $nr_worker -gt 0 ]; do
91 # half buffered I/O half direct I/O
92 if [ `expr $nr_worker % 2` -eq 0 ]; then
93 create_file $dir/$nr_worker -d >>$seqres.full &
95 create_file $dir/$nr_worker >>$seqres.full &
97 let nr_worker=$nr_worker-1