2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2014 Red Hat Inc. All Rights Reserved.
5 # FS QA Test No. generic/027
7 # Run 8 processes writing 1k files to seperate files in seperate dirs to
8 # hit ENOSPC on small fs with little free space. Loop for 100 iterations.
11 # 34cf865 ext4: fix deadlock when writing in ENOSPC conditions
14 seqres=$RESULT_DIR/$seq
15 echo "QA output created by $seq"
19 status=1 # failure is the default!
20 trap "_cleanup; exit \$status" 0 1 2 3 15
34 mkdir -p $dir >/dev/null 2>&1
35 while $XFS_IO_PROG -f $direct -c "pwrite 0 1k" $dir/file_$i >/dev/null 2>&1; do
40 # get standard environment, filters and checks
44 # real QA test starts here
50 echo "Silence is golden"
52 _scratch_mkfs_sized $((256 * 1024 * 1024)) >>$seqres.full 2>&1
55 echo "Reserve 2M space" >>$seqres.full
56 $XFS_IO_PROG -f -c "pwrite 0 2m" $SCRATCH_MNT/testfile >>$seqres.full 2>&1
57 echo "Fulfill the fs" >>$seqres.full
58 $XFS_IO_PROG -f -c "pwrite 0 254m" $SCRATCH_MNT/bigfile >>$seqres.full 2>&1
59 echo "Remove reserved file" >>$seqres.full
60 rm -f $SCRATCH_MNT/testfile
63 # btrfs takes much longer time, reduce the loop count
64 if [ "$FSTYP" == "btrfs" ]; then
68 dir=$SCRATCH_MNT/testdir
69 echo -n "iteration" >>$seqres.full
71 while [ $i -le $loop ]; do
72 echo -n " $i" >>$seqres.full
74 while [ $nr_worker -gt 0 ]; do
75 # half buffered I/O half direct I/O
76 if [ `expr $nr_worker % 2` -eq 0 ]; then
77 create_file $dir/$nr_worker -d >>$seqres.full &
79 create_file $dir/$nr_worker >>$seqres.full &
81 let nr_worker=$nr_worker-1