xfs/419: remove irrelevant swapfile test
[xfstests-dev.git] / tests / xfs / 254
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
4 #
5 # FS QA Test No. 254
6 #
7 # Ensuring that copy on write in directio mode to the source file when the
8 # CoW range covers unwritten and regular shared blocks.
9 #   - Set cowextsz.
10 #   - Create two files.
11 #   - fallocate the first file.
12 #   - Write the odd blocks of the first file.
13 #   - Reflink the odd blocks of the first file into the second file.
14 #   - DIO CoW the first file across the halfway mark, starting with the
15 #     regular extent.
16 #   - Check that the files are now different where we say they're different.
17 #
18 seq=`basename $0`
19 seqres=$RESULT_DIR/$seq
20 echo "QA output created by $seq"
21
22 here=`pwd`
23 tmp=/tmp/$$
24 status=1    # failure is the default!
25 trap "_cleanup; exit \$status" 0 1 2 3 15
26
27 _cleanup()
28 {
29     cd /
30     rm -rf $tmp.*
31 }
32
33 # get standard environment, filters and checks
34 . ./common/rc
35 . ./common/filter
36 . ./common/reflink
37
38 # real QA test starts here
39 _require_scratch_reflink
40 _require_xfs_io_command "falloc"
41 _require_xfs_io_command "cowextsize"
42 _require_odirect
43
44 rm -f $seqres.full
45
46 echo "Format and mount"
47 _scratch_mkfs > $seqres.full 2>&1
48 _scratch_mount >> $seqres.full 2>&1
49
50 testdir=$SCRATCH_MNT/test-$seq
51 mkdir $testdir
52
53 echo "Create the original files"
54 blksz=65536
55 nr=64
56 filesize=$((blksz * nr))
57 $XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
58 _sweave_reflink_unwritten $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
59 _scratch_cycle_mount
60
61 echo "Compare files"
62 md5sum $testdir/file1 | _filter_scratch
63 md5sum $testdir/file3 | _filter_scratch
64 md5sum $testdir/file1.chk | _filter_scratch
65
66 echo "CoW across the transition"
67 cowoff=$((filesize / 4))
68 cowsz=$((filesize / 2))
69 $XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
70 _pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
71 _scratch_cycle_mount
72
73 echo "Compare files"
74 md5sum $testdir/file1 | _filter_scratch
75 md5sum $testdir/file3 | _filter_scratch
76 md5sum $testdir/file1.chk | _filter_scratch
77
78 # success, all done
79 status=0
80 exit