4 # Check that high-offset dedupes work.
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved.
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation.
13 # This program is distributed in the hope that it would be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write the Free Software Foundation,
20 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #-----------------------------------------------------------------------
24 seqres=$RESULT_DIR/$seq
25 echo "QA output created by $seq"
29 status=1 # failure is the default!
30 trap "_cleanup; exit \$status" 0 1 2 3 15
35 rm -rf $tmp.* $testdir
38 # get standard environment, filters and checks
44 # real QA test starts here
51 echo "Format and mount"
52 testdir=$TEST_DIR/test-$seq
55 echo "Create the original files"
56 bigoff=9223372036854775806
57 len=9223372036854775807
58 bigoff_64k=9223372036854710272 # bigoff rounded down to 64k
59 $XFS_IO_PROG -f -c "truncate $len" $testdir/file0 >> $seqres.full
60 test -s $testdir/file0 || _notrun "High offset ftruncate failed"
61 _pwrite_byte 0x61 $bigoff 1 $testdir/file1 >> $seqres.full
62 _pwrite_byte 0x61 $bigoff 1 $testdir/file3 >> $seqres.full
63 _pwrite_byte 0x61 1048575 1 $testdir/file2 >> $seqres.full
65 echo "Dedupe large single byte file"
66 _dedupe_range $testdir/file1 0 $testdir/file3 0 $len \
67 2>&1 >> $seqres.full | _filter_dedupe_error
69 echo "Dedupe large empty file"
70 _dedupe_range $testdir/file0 0 $testdir/file4 0 $len \
71 2>&1 >> $seqres.full | _filter_dedupe_error
73 echo "Dedupe past maximum file size in dest file (should fail)"
74 _dedupe_range $testdir/file1 0 $testdir/file5 4611686018427322368 $len \
75 2>&1 >> $seqres.full | _filter_dedupe_error
77 echo "Dedupe high offset to low offset"
78 _dedupe_range $testdir/file1 $bigoff_64k $testdir/file6 1048576 65535 \
79 2>&1 >> $seqres.full | _filter_dedupe_error
81 echo "Dedupe past source file EOF (should fail)"
82 _dedupe_range $testdir/file2 524288 $testdir/file7 0 1048576 \
83 2>&1 >> $seqres.full | _filter_dedupe_error
85 echo "Dedupe max size at nonzero offset (should fail)"
86 _dedupe_range $testdir/file2 524288 $testdir/file8 0 $len \
87 2>&1 >> $seqres.full | _filter_dedupe_error
89 echo "Dedupe with huge off/len (should fail)"
90 _dedupe_range $testdir/file2 $bigoff_64k $testdir/file9 0 $bigoff_64k \
91 2>&1 >> $seqres.full | _filter_dedupe_error
93 echo "Check file creation"
96 $XFS_IO_PROG -c "pread -v -q $bigoff 1" $testdir/file3
98 $XFS_IO_PROG -c "pread -v -q $bigoff 1" $testdir/file4
99 # file5 should fail above
101 $XFS_IO_PROG -c "pread -v -q 1114110 1" $testdir/file6
102 # file7 should fail above