blob: 926de307230ee4cc34988f3d254b3a0f88b91b4d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2014 Red Hat, Inc. All Rights Reserved.
#
# FS QA Test No. 032
#
# Test xfs_copy for all filesystem sector size / block size
# combinations possible on this platform.
#
. ./common/preamble
_begin_fstest copy auto quick
status=0 # success is the default!
# Import common functions.
# real QA test starts here
_supported_fs xfs
_require_scratch
_require_test_program "feature"
_require_xfs_copy
SECTORSIZE=`blockdev --getss $SCRATCH_DEV`
PAGESIZE=`$here/src/feature -s`
IMGFILE=$TEST_DIR/${seq}_copy.img
echo "Silence is golden."
do_copy()
{
local opts="$*"
$XFS_COPY_PROG $opts $SCRATCH_DEV $IMGFILE >> $seqres.full 2>&1 || \
_fail "xfs_copy $opts failed for Sector size $SECTORSIZE Block size $BLOCKSIZE"
# Must use "-n" to get exit code; without it xfs_repair always returns 0
$XFS_REPAIR_PROG -n -f $IMGFILE >> $seqres.full 2>&1 || \
_fail "xfs_copy $opts corrupted for Sector size $SECTORSIZE Block size $BLOCKSIZE"
}
while [ $SECTORSIZE -le $PAGESIZE ]; do
BLOCKSIZE=$SECTORSIZE;
while [ $BLOCKSIZE -le $PAGESIZE ]; do
echo "=== Sector size $SECTORSIZE Block size $BLOCKSIZE ==" >> $seqres.full
_scratch_mkfs -s size=$SECTORSIZE -b size=$BLOCKSIZE -d size=1g >> $seqres.full 2>&1
# Maybe return error at here, e.g: mkfs.xfs -m crc=1 -b size=512
if [ $? -ne 0 ]; then
BLOCKSIZE=$(($BLOCKSIZE * 2))
continue
fi
_scratch_mount
# light population of the fs
$FSSTRESS_PROG -n 100 -d $SCRATCH_MNT >> $seqres.full 2>&1
_scratch_unmount
# Test "duplicate" copy at first, if $XFS_COPY_PROG won't do it.
if [[ ! "$XFS_COPY_PROG" =~ -d ]]; then
do_copy -d
fi
do_copy
BLOCKSIZE=$(($BLOCKSIZE * 2));
done
SECTORSIZE=$(($SECTORSIZE * 2));
done
# success, all done
exit
|