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
27 _require_test_program "feature"
29 [ "$USE_EXTERNAL" = yes ] && _notrun "Cannot xfs_copy with external devices"
30 [ -n "$XFS_COPY_PROG" ] || _notrun "xfs_copy binary not yet installed"
34 SECTORSIZE=`blockdev --getss $SCRATCH_DEV`
35 PAGESIZE=`src/feature -s`
36 IMGFILE=$TEST_DIR/${seq}_copy.img
38 echo "Silence is golden."
44 $XFS_COPY_PROG $opts $SCRATCH_DEV $IMGFILE >> $seqres.full 2>&1 || \
45 _fail "xfs_copy $opts failed for Sector size $SECTORSIZE Block size $BLOCKSIZE"
46 # Must use "-n" to get exit code; without it xfs_repair always returns 0
47 $XFS_REPAIR_PROG -n -f $IMGFILE >> $seqres.full 2>&1 || \
48 _fail "xfs_copy $opts corrupted for Sector size $SECTORSIZE Block size $BLOCKSIZE"
51 while [ $SECTORSIZE -le $PAGESIZE ]; do
52 BLOCKSIZE=$SECTORSIZE;
54 while [ $BLOCKSIZE -le $PAGESIZE ]; do
56 echo "=== Sector size $SECTORSIZE Block size $BLOCKSIZE ==" >> $seqres.full
57 _scratch_mkfs -s size=$SECTORSIZE -b size=$BLOCKSIZE -d size=1g >> $seqres.full 2>&1
58 # Maybe return error at here, e.g: mkfs.xfs -m crc=1 -b size=512
60 BLOCKSIZE=$(($BLOCKSIZE * 2))
64 # light population of the fs
65 $FSSTRESS_PROG -n 100 -d $SCRATCH_MNT >> $seqres.full 2>&1
68 # Test "duplicate" copy at first, if $XFS_COPY_PROG won't do it.
69 if [[ ! "$XFS_COPY_PROG" =~ -d ]]; then
74 BLOCKSIZE=$(($BLOCKSIZE * 2));
76 SECTORSIZE=$(($SECTORSIZE * 2));