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 _begin_fstest copy auto quick
13 status=0 # success is the default!
15 # Import common functions.
17 # real QA test starts here
21 _require_test_program "feature"
24 SECTORSIZE=`blockdev --getss $SCRATCH_DEV`
25 PAGESIZE=`$here/src/feature -s`
26 IMGFILE=$TEST_DIR/${seq}_copy.img
28 echo "Silence is golden."
34 $XFS_COPY_PROG $opts $SCRATCH_DEV $IMGFILE >> $seqres.full 2>&1 || \
35 _fail "xfs_copy $opts failed for Sector size $SECTORSIZE Block size $BLOCKSIZE"
36 # Must use "-n" to get exit code; without it xfs_repair always returns 0
37 $XFS_REPAIR_PROG -n -f $IMGFILE >> $seqres.full 2>&1 || \
38 _fail "xfs_copy $opts corrupted for Sector size $SECTORSIZE Block size $BLOCKSIZE"
41 while [ $SECTORSIZE -le $PAGESIZE ]; do
42 BLOCKSIZE=$SECTORSIZE;
44 while [ $BLOCKSIZE -le $PAGESIZE ]; do
46 echo "=== Sector size $SECTORSIZE Block size $BLOCKSIZE ==" >> $seqres.full
47 _scratch_mkfs -s size=$SECTORSIZE -b size=$BLOCKSIZE -d size=1g >> $seqres.full 2>&1
48 # Maybe return error at here, e.g: mkfs.xfs -m crc=1 -b size=512
50 BLOCKSIZE=$(($BLOCKSIZE * 2))
54 # light population of the fs
55 $FSSTRESS_PROG -n 100 -d $SCRATCH_MNT >> $seqres.full 2>&1
58 # Test "duplicate" copy at first, if $XFS_COPY_PROG won't do it.
59 if [[ ! "$XFS_COPY_PROG" =~ -d ]]; then
64 BLOCKSIZE=$(($BLOCKSIZE * 2));
66 SECTORSIZE=$(($SECTORSIZE * 2));