fsx/fsstress: round blocksize properly
[xfstests-dev.git] / tests / generic / 347
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. generic/347
6 #
7 # Test very basic thin device usage, exhaustion, and growth
8 #
9 #
10 seq=`basename $0`
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
13
14 here=`pwd`
15 tmp=/tmp/$$
16
17 status=1        # failure is the default!
18 trap "_cleanup; exit \$status" 0 1 2 3 15
19
20 BACKING_SIZE=$((500 * 1024 * 1024 / 512))       # 500M
21 VIRTUAL_SIZE=$((10 * $BACKING_SIZE))            # 5000M
22 GROW_SIZE=$((100 * 1024 * 1024 / 512))          # 100M
23
24 _cleanup()
25 {
26         _dmthin_cleanup
27         rm -f $tmp.*
28 }
29
30 _setup_thin()
31 {
32         _dmthin_init $BACKING_SIZE $VIRTUAL_SIZE
33         _dmthin_set_queue
34         _dmthin_mkfs
35         _dmthin_mount
36 }
37
38 _workout()
39 {
40         # Overfill it by a bit
41         for I in `seq 1 500`; do
42                 $XFS_IO_PROG -f -c "pwrite -W 0 1M" $SCRATCH_MNT/file$I &>/dev/null
43         done
44
45         sync
46
47         _dmthin_grow  $GROW_SIZE
48
49         # Write a little more, but don't fill
50         for I in `seq 501 510`; do
51                 $XFS_IO_PROG -f -c "pwrite 0 1M" $SCRATCH_MNT/file$I &>/dev/null
52         done
53 }
54
55 # get standard environment, filters and checks
56 . ./common/rc
57 . ./common/dmthin
58
59 _supported_fs generic
60 _require_scratch_nocheck
61 _require_dm_target thin-pool
62
63 _setup_thin
64 _workout
65 _dmthin_check_fs
66 _dmthin_cleanup
67
68 echo "=== completed"
69
70 status=0
71 exit