4 # Tests file clone functionality of btrfs ("reflinks"):
6 # - Reflink the reflinked file
7 # - Modify the original file
8 # - Modify the reflinked file
10 #-----------------------------------------------------------------------
11 # Copyright (c) 2014, Oracle and/or its affiliates. All Rights Reserved.
13 # This program is free software; you can redistribute it and/or
14 # modify it under the terms of the GNU General Public License as
15 # published by the Free Software Foundation.
17 # This program is distributed in the hope that it would be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write the Free Software Foundation,
24 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 #-----------------------------------------------------------------------
29 seqres=$RESULT_DIR/$seq
30 echo "QA output created by $seq"
34 status=1 # failure is the default!
35 trap "_cleanup; exit \$status" 0 1 2 3 15
43 # get standard environment, filters and checks
48 # real QA test starts here
52 _require_xfs_io_command "fiemap"
56 testdir1=$TEST_DIR/test-$seq
61 for F in original copy1 copy2
63 md5sum $testdir1/$F | _filter_test_dir
69 echo "Create the original file and reflink to copy1, copy2"
70 $XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $testdir1/original \
72 cp --reflink $testdir1/original $testdir1/copy1
73 cp --reflink $testdir1/copy1 $testdir1/copy2
74 _verify_reflink $testdir1/original $testdir1/copy1
75 _verify_reflink $testdir1/original $testdir1/copy2
76 echo "Original md5sums:"
79 echo "Overwrite original file with new data"
80 $XFS_IO_PROG -c 'pwrite -S 0x62 0 9000' $testdir1/original \
82 echo "md5sums after overwriting original:"
85 echo "Overwrite copy1 with different new data"
86 $XFS_IO_PROG -c 'pwrite -S 0x63 0 9000' $testdir1/copy1 \
88 echo "md5sums after overwriting copy1:"