xfs: Check for extent overflow when trivally adding a new extent
[xfstests-dev.git] / tests / ocfs2 / 001
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017, Oracle and/or its affiliates.  All Rights Reserved.
4 #
5 # FS QA Test No. 001
6 #
7 # Ensure that reflink works correctly with inline-data files.
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=1    # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
17
18 _cleanup()
19 {
20     cd /
21     rm -rf $tmp.*
22 }
23
24 # get standard environment, filters and checks
25 . ./common/rc
26 . ./common/filter
27 . ./common/reflink
28
29 # real QA test starts here
30 _supported_fs ocfs2
31 _require_scratch_reflink
32 _require_cp_reflink
33
34 rm -f $seqres.full
35
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
41
42 testdir=$SCRATCH_MNT/test-$seq
43 mkdir $testdir
44
45 sz=65536
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
53 _scratch_cycle_mount
54
55 echo "reflink into the start of file2"
56 _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
57
58 echo "reflink past the stuff in file3"
59 _reflink_range $testdir/file1 0 $testdir/file3 $sz $sz >> $seqres.full
60
61 echo "reflink an inline-data file to a regular one"
62 _cp_reflink $testdir/file4 $testdir/file5 >> $seqres.full
63
64 echo "reflink an inline-data file to another inline-data file"
65 _cp_reflink $testdir/file4 $testdir/file6 >> $seqres.full
66
67 echo "Verify the whole mess"
68 _scratch_cycle_mount
69 md5sum $testdir/file* | _filter_scratch
70
71 # success, all done
72 status=0
73 exit