btrfs/012: check free size of scratch device before copying files
[xfstests-dev.git] / tests / xfs / 167
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2007 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FSQA Test No. 167
6 #
7 # unwritten extent conversion test
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 rm -f $seqres.full
16 status=1    # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
18
19 _cleanup()
20 {
21         $KILLALL_PROG -r -q -TERM fsstress 2> /dev/null
22         wait    # ensures all fsstress processes died
23 }
24
25 workout()
26 {
27         procs=100
28         nops=15000
29         FSSTRESS_ARGS=`_scale_fsstress_args -d $SCRATCH_MNT -p $procs -n $nops \
30             $FSSTRESS_AVOID`
31         $FSSTRESS_PROG $FSSTRESS_ARGS >> $seqres.full &
32         sleep 2
33 }
34
35 # get standard environment, filters and checks
36 . ./common/rc
37 . ./common/filter
38
39 # real QA test starts here
40 _supported_fs xfs
41
42 _require_command "$KILLALL_PROG" killall
43 _require_xfs_io_command "falloc"
44
45 _require_scratch
46 _scratch_mkfs_xfs >/dev/null 2>&1
47 _scratch_mount
48
49 # fast devices can consume disk space at a rate of 1GB every 5s via the
50 # background workload. With 50 test loops, at 1 second per loop, that means we
51 # need at least 10GB of disk space to ensure this test will not fail with ENOSPC
52 # errors.
53 _require_fs_space $SCRATCH_MNT 10485760
54
55 TEST_FILE=$SCRATCH_MNT/test_file
56 TEST_PROG=$here/src/unwritten_sync
57 LOOPS=50
58
59 echo "*** test unwritten extent conversion under heavy I/O"
60
61 workout
62
63 rm -f $TEST_FILE
64 $TEST_PROG $LOOPS $TEST_FILE
65
66 echo "     *** test done"
67
68 status=0
69 exit