4 # Test xfs_copy for all filesystem sector size / block size
5 # combinations possible on this platform.
7 #-----------------------------------------------------------------------
8 # Copyright (c) 2014 Red Hat, Inc. All Rights Reserved.
10 # This program is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License as
12 # published by the Free Software Foundation.
14 # This program is distributed in the hope that it would be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write the Free Software Foundation,
21 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #-----------------------------------------------------------------------
27 seqres=$RESULT_DIR/$seq
28 echo "QA output created by $seq"
32 status=0 # success is the default!
33 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
35 # get standard environment, filters and checks
38 # real QA test starts here
43 _require_test_program "feature"
45 [ "$USE_EXTERNAL" = yes ] && _notrun "Cannot xfs_copy with external devices"
46 [ -n "$XFS_COPY_PROG" ] || _notrun "xfs_copy binary not yet installed"
50 SECTORSIZE=`blockdev --getss $SCRATCH_DEV`
51 PAGESIZE=`src/feature -s`
52 IMGFILE=$TEST_DIR/${seq}_copy.img
54 echo "Silence is golden."
60 $XFS_COPY_PROG $opts $SCRATCH_DEV $IMGFILE >> $seqres.full 2>&1 || \
61 _fail "xfs_copy $opts failed for Sector size $SECTORSIZE Block size $BLOCKSIZE"
62 # Must use "-n" to get exit code; without it xfs_repair always returns 0
63 $XFS_REPAIR_PROG -n -f $IMGFILE >> $seqres.full 2>&1 || \
64 _fail "xfs_copy $opts corrupted for Sector size $SECTORSIZE Block size $BLOCKSIZE"
67 while [ $SECTORSIZE -le $PAGESIZE ]; do
68 BLOCKSIZE=$SECTORSIZE;
70 while [ $BLOCKSIZE -le $PAGESIZE ]; do
72 echo "=== Sector size $SECTORSIZE Block size $BLOCKSIZE ==" >> $seqres.full
73 _scratch_mkfs -s size=$SECTORSIZE -b size=$BLOCKSIZE -d size=1g >> $seqres.full 2>&1
74 # Maybe return error at here, e.g: mkfs.xfs -m crc=1 -b size=512
76 BLOCKSIZE=$(($BLOCKSIZE * 2))
80 # light population of the fs
81 $FSSTRESS_PROG -n 100 -d $SCRATCH_MNT >> $seqres.full 2>&1
84 # Test "duplicate" copy at first, if $XFS_COPY_PROG won't do it.
85 if [[ ! "$XFS_COPY_PROG" =~ -d ]]; then
90 BLOCKSIZE=$(($BLOCKSIZE * 2));
92 SECTORSIZE=$(($SECTORSIZE * 2));