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 _begin_fstest auto enospc
22 mkdir -p $dir >/dev/null 2>&1
23 while $XFS_IO_PROG -f $direct -c "pwrite 0 1k" $dir/file_$i >/dev/null 2>&1; do
28 # Import common functions.
31 # real QA test starts here
36 echo "Silence is golden"
38 _scratch_mkfs_sized $((256 * 1024 * 1024)) >>$seqres.full 2>&1
41 echo "Reserve 2M space" >>$seqres.full
42 $XFS_IO_PROG -f -c "pwrite 0 2m" $SCRATCH_MNT/testfile >>$seqres.full 2>&1
43 echo "Fulfill the fs" >>$seqres.full
44 $XFS_IO_PROG -f -c "pwrite 0 254m" $SCRATCH_MNT/bigfile >>$seqres.full 2>&1
45 echo "Remove reserved file" >>$seqres.full
46 rm -f $SCRATCH_MNT/testfile
49 # btrfs takes much longer time, reduce the loop count
50 if [ "$FSTYP" == "btrfs" ]; then
54 dir=$SCRATCH_MNT/testdir
55 echo -n "iteration" >>$seqres.full
57 while [ $i -le $loop ]; do
58 echo -n " $i" >>$seqres.full
60 while [ $nr_worker -gt 0 ]; do
61 # half buffered I/O half direct I/O
62 if [ `expr $nr_worker % 2` -eq 0 ]; then
63 create_file $dir/$nr_worker -d >>$seqres.full &
65 create_file $dir/$nr_worker >>$seqres.full &
67 let nr_worker=$nr_worker-1