2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved.
7 # Ensure that we can create enough distinct rmap entries to force creation
8 # of a multi-level rmap btree, and that metadump will successfully copy
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
17 status=1 # failure is the default!
18 trap "_cleanup; exit \$status" 0 1 2 3 15
23 _scratch_unmount > /dev/null 2>&1
24 rm -rf $tmp.* $metadump_file $TEST_DIR/image
27 # get standard environment, filters and checks
31 # real QA test starts here
34 _require_xfs_scratch_rmapbt
35 _require_xfs_io_command "fpunch"
39 _scratch_mkfs >/dev/null 2>&1
42 testdir=$SCRATCH_MNT/test-$seq
44 metadump_file=$TEST_DIR/${seq}_metadump
46 echo "Create the original file blocks"
47 blksz="$(_get_block_size $testdir)"
48 nr_blks=$((4 * blksz / 12))
49 _pwrite_byte 0x61 0 $((blksz * nr_blks)) $testdir/file1 >> $seqres.full
52 echo "Punch every other block"
53 seq 1 2 $((nr_blks - 1)) | while read nr; do
54 $XFS_IO_PROG -c "fpunch $((nr * blksz)) $blksz" $testdir/file1 >> $seqres.full
57 echo "Create metadump file"
59 _scratch_xfs_metadump $metadump_file
61 # Now restore the obfuscated one back and take a look around
62 echo "Restore metadump"
63 xfs_mdrestore $metadump_file $TEST_DIR/image
64 SCRATCH_DEV=$TEST_DIR/image _scratch_mount
65 SCRATCH_DEV=$TEST_DIR/image _scratch_unmount
67 echo "Check restored fs"
68 _check_generic_filesystem $metadump_file