2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017, Oracle and/or its affiliates. All Rights Reserved.
7 # Ensure that reflink works correctly with inline-data files.
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
24 # get standard environment, filters and checks
29 # real QA test starts here
31 _require_scratch_reflink
36 echo "Format and mount"
37 _scratch_mkfs --fs-features=local,unwritten,refcount,inline-data > $seqres.full 2>&1
38 tunefs.ocfs2 --query '%H' $SCRATCH_DEV | grep -q 'inline-data' || \
39 _notrun "Inline data is not supported."
40 _scratch_mount >> $seqres.full 2>&1
42 testdir=$SCRATCH_MNT/test-$seq
46 echo "Create the original files"
47 $XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
48 echo x > $testdir/file2
49 echo x > $testdir/file3
50 echo y > $testdir/file4
51 $XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file5 >> $seqres.full
52 echo a > $testdir/file6
55 echo "reflink into the start of file2"
56 _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
58 echo "reflink past the stuff in file3"
59 _reflink_range $testdir/file1 0 $testdir/file3 $sz $sz >> $seqres.full
61 echo "reflink an inline-data file to a regular one"
62 _cp_reflink $testdir/file4 $testdir/file5 >> $seqres.full
64 echo "reflink an inline-data file to another inline-data file"
65 _cp_reflink $testdir/file4 $testdir/file6 >> $seqres.full
67 echo "Verify the whole mess"
69 md5sum $testdir/file* | _filter_scratch