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 _begin_fstest auto clone
12 # Import common functions.
17 # real QA test starts here
18 _require_scratch_reflink
23 echo "Format and mount"
24 _scratch_mkfs > "$seqres.full" 2>&1
25 _scratch_mount >> "$seqres.full" 2>&1
27 testdir="$SCRATCH_MNT/test-$seq"
30 echo "Create a one block file"
31 blksz="$(_get_file_block_size $testdir)"
32 _pwrite_byte 0x61 0 $blksz "$testdir/file1" >> "$seqres.full"
36 truncate -s $(( (2 ** i) * blksz)) "$testdir/file1"
37 for i in $(seq 0 $fnr); do
38 echo " ++ Reflink size $i, $((2 ** i)) blocks" >> "$seqres.full"
39 n=$(( (2 ** i) * blksz))
40 _reflink_range "$testdir/file1" 0 "$testdir/file1" $n $n >> "$seqres.full"
44 echo "Reflink the big file"
45 blks=$((2 ** (fnr + 1) ))
46 bytes=$((blks * blksz))
47 echo "reflinking $blks blocks, $bytes bytes" >> "$seqres.full"
48 _reflink_range "$testdir/file1" 0 "$testdir/file2" 0 $bytes >> "$seqres.full"