generic: test MADV_POPULATE_READ with IO errors
[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 . ./common/preamble
10 _begin_fstest auto quick clone
11
12 # Import common functions.
13 . ./common/filter
14 . ./common/reflink
15
16 # real QA test starts here
17 _supported_fs ocfs2
18 _require_scratch_reflink
19 _require_cp_reflink
20
21 echo "Format and mount"
22 _scratch_mkfs --fs-features=local,unwritten,refcount,inline-data > $seqres.full 2>&1
23 tunefs.ocfs2 --query '%H' $SCRATCH_DEV | grep -q 'inline-data' || \
24         _notrun "Inline data is not supported."
25 _scratch_mount >> $seqres.full 2>&1
26
27 testdir=$SCRATCH_MNT/test-$seq
28 mkdir $testdir
29
30 sz=65536
31 echo "Create the original files"
32 $XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
33 echo x > $testdir/file2
34 echo x > $testdir/file3
35 echo y > $testdir/file4
36 $XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file5 >> $seqres.full
37 echo a > $testdir/file6
38 _scratch_cycle_mount
39
40 echo "reflink into the start of file2"
41 _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
42
43 echo "reflink past the stuff in file3"
44 _reflink_range $testdir/file1 0 $testdir/file3 $sz $sz >> $seqres.full
45
46 echo "reflink an inline-data file to a regular one"
47 _cp_reflink $testdir/file4 $testdir/file5 >> $seqres.full
48
49 echo "reflink an inline-data file to another inline-data file"
50 _cp_reflink $testdir/file4 $testdir/file6 >> $seqres.full
51
52 echo "Verify the whole mess"
53 _scratch_cycle_mount
54 md5sum $testdir/file* | _filter_scratch
55
56 # success, all done
57 status=0
58 exit