xfs: force file creation to the data device for certain layout tests
[xfstests-dev.git] / tests / generic / 102
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015 Fujitsu.  All Rights Reserved.
4 #
5 # FS QA Test No. 102
6 #
7 # TEST busy loop of write and delete in a filesystem.
8 # Sometimes writes will failed on NO_SPACE when disk almost full
9 # in btrfs. It is long-term problem since very beginning for btrfs
10 #
11 # This issue was fixed by the patchset named:
12 #
13 # btrfs: Fix no_space on dd and rm loop < from zhaolei@cn.fujitsu.com >
14 #
15 seq=`basename $0`
16 seqres=$RESULT_DIR/$seq
17 echo "QA output created by $seq"
18
19 tmp=/tmp/$$
20 status=1
21 trap "exit \$status" 0 1 2 3 15
22
23 # get standard environment, filters and checks
24 . ./common/rc
25 . ./common/filter
26
27 # real QA test starts here
28 _supported_fs generic
29 _require_scratch
30
31 rm -f $seqres.full
32
33 dev_size=$((1024 * 1024 * 1024))     # 1GB filesystem
34 _scratch_mkfs_sized $dev_size >>$seqres.full 2>&1
35 _scratch_mount
36
37 for ((i = 0; i < 10; i++)); do
38         echo "loop $i" >>$seqres.full
39
40         $XFS_IO_PROG -f -c "pwrite -b 1m 0 800m" "$SCRATCH_MNT"/file | \
41 _filter_xfs_io | _filter_scratch
42
43         rm -f "$SCRATCH_MNT"/file
44 done
45
46 status=0
47 exit