fsx/fsstress: round blocksize properly
[xfstests-dev.git] / tests / generic / 031
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2014 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. generic/031
6 #
7 # Test non-aligned writes against fcollapse to ensure that partial pages are
8 # correctly written and aren't left behind causing invalidation or data
9 # corruption issues.
10 #
11 seq=`basename $0`
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
14
15 here=`pwd`
16 tmp=/tmp/$$
17 status=1        # failure is the default!
18 trap "_cleanup; exit \$status" 0 1 2 3 15
19
20 _cleanup()
21 {
22     cd /
23     rm -f $tmp.*
24 }
25
26 # get standard environment, filters and checks
27 . ./common/rc
28 . ./common/filter
29
30 # real QA test starts here
31
32 # Modify as appropriate.
33 _supported_fs generic
34 _require_scratch
35 _require_xfs_io_command "fcollapse"
36
37 testfile=$SCRATCH_MNT/testfile
38
39 _scratch_mkfs > /dev/null 2>&1
40 _scratch_mount
41
42 $XFS_IO_PROG -f \
43         -c "pwrite 185332 55756" \
44         -c "fcollapse 28672 40960" \
45         -c "pwrite 133228 63394" \
46         -c "fcollapse 0 4096" \
47 $testfile | _filter_xfs_io
48
49 echo "==== Pre-Remount ==="
50 hexdump -C $testfile
51 _scratch_cycle_mount
52 echo "==== Post-Remount =="
53 hexdump -C $testfile
54
55 status=0
56 exit
57