2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved.
7 # Check that high-offset dedupes work.
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
21 rm -rf $tmp.* $testdir
24 # get standard environment, filters and checks
30 # real QA test starts here
37 echo "Format and mount"
38 testdir=$TEST_DIR/test-$seq
41 echo "Create the original files"
42 bigoff=9223372036854775806
43 len=9223372036854775807
44 bigoff_64k=9223372036854710272 # bigoff rounded down to 64k
45 $XFS_IO_PROG -f -c "truncate $len" $testdir/file0 >> $seqres.full
46 test -s $testdir/file0 || _notrun "High offset ftruncate failed"
47 _pwrite_byte 0x61 $bigoff 1 $testdir/file1 >> $seqres.full
48 _pwrite_byte 0x61 $bigoff 1 $testdir/file3 >> $seqres.full
49 _pwrite_byte 0x61 1048575 1 $testdir/file2 >> $seqres.full
51 echo "Dedupe large single byte file"
52 _dedupe_range $testdir/file1 $bigoff_64k $testdir/file3 $bigoff_64k 65536 \
53 2>&1 >> $seqres.full | _filter_dedupe_error
55 echo "Dedupe large empty file"
56 _dedupe_range $testdir/file0 0 $testdir/file4 0 $len \
57 2>&1 >> $seqres.full | _filter_dedupe_error
59 echo "Dedupe past maximum file size in dest file (should fail)"
60 _dedupe_range $testdir/file1 0 $testdir/file5 4611686018427322368 $len \
61 2>&1 >> $seqres.full | _filter_dedupe_error
63 echo "Dedupe high offset to low offset"
64 _dedupe_range $testdir/file1 $bigoff_64k $testdir/file6 1048576 65535 \
65 2>&1 >> $seqres.full | _filter_dedupe_error
67 echo "Dedupe past source file EOF (should fail)"
68 _dedupe_range $testdir/file2 524288 $testdir/file7 0 1048576 \
69 2>&1 >> $seqres.full | _filter_dedupe_error
71 echo "Dedupe max size at nonzero offset (should fail)"
72 _dedupe_range $testdir/file2 524288 $testdir/file8 0 $len \
73 2>&1 >> $seqres.full | _filter_dedupe_error
75 echo "Dedupe with huge off/len (should fail)"
76 _dedupe_range $testdir/file2 $bigoff_64k $testdir/file9 0 $bigoff_64k \
77 2>&1 >> $seqres.full | _filter_dedupe_error
79 echo "Check file creation"
82 $XFS_IO_PROG -c "pread -v -q $bigoff 1" $testdir/file3
84 $XFS_IO_PROG -c "pread -v -q $bigoff 1" $testdir/file4
85 # file5 should fail above
87 $XFS_IO_PROG -c "pread -v -q 1114110 1" $testdir/file6
88 # file7 should fail above