2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2014, Oracle and/or its affiliates. All Rights Reserved.
7 # Moving and deleting cloned ("reflinked") files on btrfs:
8 # - Create a file and a reflink
9 # - Move both to a directory
10 # - Delete the original (moved) file, check that the copy still exists.
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
18 status=1 # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
27 # get standard environment, filters and checks
32 # real QA test starts here
36 _require_xfs_io_command "fiemap"
42 testdir1=$TEST_DIR/test-$seq
46 echo "Create the original files and reflink dirs"
47 $XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $testdir1/original \
49 cp --reflink $testdir1/original $testdir1/copy
51 _verify_reflink $testdir1/original $testdir1/copy
53 echo "Move orig & reflink copy to subdir and md5sum:"
54 mkdir $testdir1/subdir
55 mv $testdir1/original $testdir1/subdir/original_moved
56 mv $testdir1/copy $testdir1/subdir/copy_moved
57 _verify_reflink $testdir1/subdir/original_moved \
58 $testdir1/subdir/copy_moved
60 md5sum $testdir1/subdir/original_moved | _filter_test_dir
61 md5sum $testdir1/subdir/copy_moved | _filter_test_dir
63 echo "remove orig from subdir and md5sum reflink copy:"
64 rm $testdir1/subdir/original_moved
65 md5sum $testdir1/subdir/copy_moved | _filter_test_dir
66 rm -rf $testdir1/subdir