2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved.
7 # See how well reflink handles reflinking the same block a million times.
10 seqres="$RESULT_DIR/$seq"
11 echo "QA output created by $seq"
15 status=1 # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
24 # get standard environment, filters and checks
30 # real QA test starts here
31 _require_scratch_reflink
36 echo "Format and mount"
37 _scratch_mkfs > "$seqres.full" 2>&1
38 _scratch_mount >> "$seqres.full" 2>&1
40 testdir="$SCRATCH_MNT/test-$seq"
43 echo "Create a one block file"
44 blksz="$(_get_file_block_size $testdir)"
45 _pwrite_byte 0x61 0 $blksz "$testdir/file1" >> "$seqres.full"
49 truncate -s $(( (2 ** i) * blksz)) "$testdir/file1"
50 for i in $(seq 0 $fnr); do
51 echo " ++ Reflink size $i, $((2 ** i)) blocks" >> "$seqres.full"
52 n=$(( (2 ** i) * blksz))
53 _reflink_range "$testdir/file1" 0 "$testdir/file1" $n $n >> "$seqres.full"
57 echo "Reflink the big file"
58 blks=$((2 ** (fnr + 1) ))
59 bytes=$((blks * blksz))
60 echo "reflinking $blks blocks, $bytes bytes" >> "$seqres.full"
61 _reflink_range "$testdir/file1" 0 "$testdir/file2" 0 $bytes >> "$seqres.full"