2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2014 Red Hat, Inc. All Rights Reserved.
7 # Test xfs_copy for all filesystem sector size / block size
8 # combinations possible on this platform.
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
16 status=0 # success is the default!
17 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
19 # get standard environment, filters and checks
22 # real QA test starts here
26 _require_test_program "feature"
31 SECTORSIZE=`blockdev --getss $SCRATCH_DEV`
32 PAGESIZE=`$here/src/feature -s`
33 IMGFILE=$TEST_DIR/${seq}_copy.img
35 echo "Silence is golden."
41 $XFS_COPY_PROG $opts $SCRATCH_DEV $IMGFILE >> $seqres.full 2>&1 || \
42 _fail "xfs_copy $opts failed for Sector size $SECTORSIZE Block size $BLOCKSIZE"
43 # Must use "-n" to get exit code; without it xfs_repair always returns 0
44 $XFS_REPAIR_PROG -n -f $IMGFILE >> $seqres.full 2>&1 || \
45 _fail "xfs_copy $opts corrupted for Sector size $SECTORSIZE Block size $BLOCKSIZE"
48 while [ $SECTORSIZE -le $PAGESIZE ]; do
49 BLOCKSIZE=$SECTORSIZE;
51 while [ $BLOCKSIZE -le $PAGESIZE ]; do
53 echo "=== Sector size $SECTORSIZE Block size $BLOCKSIZE ==" >> $seqres.full
54 _scratch_mkfs -s size=$SECTORSIZE -b size=$BLOCKSIZE -d size=1g >> $seqres.full 2>&1
55 # Maybe return error at here, e.g: mkfs.xfs -m crc=1 -b size=512
57 BLOCKSIZE=$(($BLOCKSIZE * 2))
61 # light population of the fs
62 $FSSTRESS_PROG -n 100 -d $SCRATCH_MNT >> $seqres.full 2>&1
65 # Test "duplicate" copy at first, if $XFS_COPY_PROG won't do it.
66 if [[ ! "$XFS_COPY_PROG" =~ -d ]]; then
71 BLOCKSIZE=$(($BLOCKSIZE * 2));
73 SECTORSIZE=$(($SECTORSIZE * 2));