blob: d67ac4d6c1f9f933c45a5d3e65789e1ca00af832 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved.
#
# FS QA Test No. 271
#
# Check that getfsmap reports the AG metadata we're expecting.
#
. ./common/preamble
_begin_fstest auto quick rmap fsmap
# Override the default cleanup function.
_cleanup()
{
cd /
rm -rf "$tmp".* $TEST_DIR/fsmap $TEST_DIR/testout
}
# Import common functions.
. ./common/filter
# real QA test starts here
_supported_fs xfs
_require_xfs_scratch_rmapbt
_require_xfs_io_command "fsmap"
rm -f "$seqres.full"
echo "Format and mount"
_scratch_mkfs > "$seqres.full" 2>&1
_scratch_mount
agcount=$(_xfs_mount_agcount $SCRATCH_MNT)
# mkfs lays out btree root blocks in the order bnobt, cntbt, inobt, finobt,
# rmapbt, refcountbt, and then allocates AGFL blocks. Since GETFSMAP has the
# same owner (per-AG metadata) for rmap btree blocks and blocks on the AGFL and
# the reverse mapping index merges records, the number of per-AG extents
# reported will vary depending on whether the refcount btree is enabled.
_require_xfs_has_feature "$SCRATCH_MNT" reflink
has_reflink=$(( 1 - $? ))
perag_metadata_exts=2
test $has_reflink -gt 0 && perag_metadata_exts=$((perag_metadata_exts + 1))
echo "Get fsmap" | tee -a $seqres.full
$XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT > $TEST_DIR/fsmap
cat $TEST_DIR/fsmap >> $seqres.full
echo "Check AG header" | tee -a $seqres.full
grep 'static fs metadata[[:space:]]*[0-9]*[[:space:]]*(0\.\.' $TEST_DIR/fsmap | tee -a $seqres.full > $TEST_DIR/testout
_within_tolerance "AG header count" $(wc -l < $TEST_DIR/testout) $agcount 0 -v
echo "Check freesp/rmap btrees" | tee -a $seqres.full
grep 'per-AG metadata[[:space:]]*[0-9]*[[:space:]]*([0-9]*\.\.' $TEST_DIR/fsmap | tee -a $seqres.full > $TEST_DIR/testout
_within_tolerance "freesp extent count" $(wc -l < $TEST_DIR/testout) $((agcount * perag_metadata_exts)) 0 999999 -v
echo "Check inode btrees" | tee -a $seqres.full
grep 'inode btree[[:space:]]*[0-9]*[[:space:]]*([0-9]*\.\.' $TEST_DIR/fsmap | tee -a $seqres.full > $TEST_DIR/testout
_within_tolerance "inode btree extent count" $(wc -l < $TEST_DIR/testout) $agcount 0 -v
echo "Check inodes" | tee -a $seqres.full
grep 'inodes[[:space:]]*[0-9]*[[:space:]]*([0-9]*\.\.' $TEST_DIR/fsmap | tee -a $seqres.full > $TEST_DIR/testout
_within_tolerance "inode extent count" $(wc -l < $TEST_DIR/testout) 1 0 999999 -v
echo "Check journal" | tee -a $seqres.full
grep 'journalling log' $TEST_DIR/fsmap | tee -a $seqres.full > $TEST_DIR/testout
_within_tolerance "journal extent count" $(wc -l < $TEST_DIR/testout) 1 0 -v
# success, all done
status=0
exit
|