4 # Ensure that we can create enough distinct rmap entries to force creation
5 # of a multi-level rmap btree, and that metadump will successfully copy
8 #-----------------------------------------------------------------------
9 # Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved.
11 # This program is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU General Public License as
13 # published by the Free Software Foundation.
15 # This program is distributed in the hope that it would be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write the Free Software Foundation,
22 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #-----------------------------------------------------------------------
26 seqres=$RESULT_DIR/$seq
27 echo "QA output created by $seq"
31 status=1 # failure is the default!
32 trap "_cleanup; exit \$status" 0 1 2 3 15
37 _scratch_unmount > /dev/null 2>&1
38 rm -rf $tmp.* $metadump_file $TEST_DIR/image
41 # get standard environment, filters and checks
45 # real QA test starts here
49 _require_xfs_scratch_rmapbt
50 _require_xfs_io_command "fpunch"
54 _scratch_mkfs >/dev/null 2>&1
57 testdir=$SCRATCH_MNT/test-$seq
59 metadump_file=$TEST_DIR/${seq}_metadump
61 echo "Create the original file blocks"
62 blksz="$(get_block_size $testdir)"
63 nr_blks=$((4 * blksz / 12))
64 _pwrite_byte 0x61 0 $((blksz * nr_blks)) $testdir/file1 >> $seqres.full
67 echo "Punch every other block"
68 seq 1 2 $((nr_blks - 1)) | while read nr; do
69 $XFS_IO_PROG -c "fpunch $((nr * blksz)) $blksz" $testdir/file1 >> $seqres.full
72 echo "Create metadump file"
74 _scratch_metadump $metadump_file
76 # Now restore the obfuscated one back and take a look around
77 echo "Restore metadump"
78 xfs_mdrestore $metadump_file $TEST_DIR/image
79 SCRATCH_DEV=$TEST_DIR/image _scratch_mount
80 SCRATCH_DEV=$TEST_DIR/image _scratch_unmount
82 echo "Check restored fs"
83 _check_generic_filesystem $metadump_file