fsx/fsstress: round blocksize properly
[xfstests-dev.git] / tests / ext4 / 307
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FSQA Test No. 307
6 #
7 # Check data integrity during defrag compacting
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 status=1        # failure is the default!
16 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
17
18 # get standard environment, filters and checks
19 . ./common/rc
20 . ./common/filter
21 . ./common/defrag
22 # Disable all sync operations to get higher load
23 FSSTRESS_AVOID="$FSSTRESS_AVOID -ffsync=0 -fsync=0 -ffdatasync=0"
24 _workout()
25 {
26         echo ""
27         echo "Run fsstress"
28         out=$SCRATCH_MNT/fsstress.$$
29         args=`_scale_fsstress_args -p4 -n999 -f setattr=1 $FSSTRESS_AVOID -d $out`
30         echo "fsstress $args" >> $seqres.full
31         $FSSTRESS_PROG $args > /dev/null 2>&1
32         find $out -type f > $out.list
33         cat $out.list | xargs  md5sum > $out.md5sum
34         usage=`du -sch $out | tail -n1 | gawk '{ print $1 }'`
35         echo "Allocate donor file"
36         $XFS_IO_PROG -c "falloc 0 250M" -f $SCRATCH_MNT/donor | _filter_xfs_io
37         echo "Perform compacting"
38         cat $out.list | run_check $here/src/e4compact \
39                 -i -v -f $SCRATCH_MNT/donor  >> $seqres.full 2>&1
40         echo "Check data"
41         run_check md5sum -c $out.md5sum
42 }
43
44 # real QA test starts here
45 _supported_fs generic
46 _supported_fs ext4
47 _require_scratch
48 _require_defrag
49 _require_xfs_io_command "falloc"
50
51 rm -f $seqres.full
52 _scratch_mkfs_sized $((512 * 1024 * 1024)) >> $seqres.full 2>&1
53 _scratch_mount
54
55 _workout
56 status=0
57 exit