xfs: no excessive warnings about dprecated mount options on remount
[xfstests-dev.git] / tests / xfs / 280
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Oracle, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 280
6 #
7 # Check that GETBMAPX accurately report shared extents.
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 7 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 xfs
31 _require_scratch_reflink
32 _require_xfs_io_command "bmap"
33 _require_xfs_io_command "falloc"
34
35 echo "Format and mount"
36 _scratch_mkfs > $seqres.full 2>&1
37 _scratch_mount >> $seqres.full 2>&1
38
39 testdir=$SCRATCH_MNT/test-$seq
40 mkdir $testdir
41
42 blocks=5
43 blksz=65536
44 sz=$((blocks * blksz))
45
46 echo "Create the original files"
47 $XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file1 >> $seqres.full
48 _pwrite_byte 0x61 0 $sz $testdir/file1 >> $seqres.full
49 _scratch_cycle_mount
50
51 bmap() {
52         $XFS_IO_PROG -c 'bmap -v' $1 | grep '^[[:space:]]*[0-9]*:'
53 }
54
55 echo "file1 extents and holes"
56 bmap $testdir/file1 | grep -v -c hole
57 bmap $testdir/file1 | grep -c hole
58
59 _reflink_range $testdir/file1 $blksz $testdir/file2 $((blksz * 3)) $blksz >> $seqres.full
60 _reflink_range $testdir/file1 $((blksz * 3)) $testdir/file2 $blksz $blksz >> $seqres.full
61 _scratch_cycle_mount
62
63 echo "Compare files"
64 md5sum $testdir/file1 | _filter_scratch
65 md5sum $testdir/file2 | _filter_scratch
66
67 echo "file1 extents and holes"
68 bmap $testdir/file1 | grep -v -c hole
69 bmap $testdir/file1 | grep -c hole
70 echo "file2 extents and holes"
71 bmap $testdir/file2 | grep -v -c hole
72 bmap $testdir/file2 | grep -c hole
73 echo "file1 shared extents"
74 bmap $testdir/file1 | grep -c '1.....$'
75
76 # success, all done
77 status=0
78 exit