fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: djwong@kernel.org, guaneryu@gmail.com
Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me
Subject: [PATCH 2/4] xfs/271: fix test failure on non-reflink filesystems
Date: Tue, 02 Mar 2021 15:22:45 -0800	[thread overview]
Message-ID: <161472736521.3478298.1405183245326186350.stgit@magnolia> (raw)
In-Reply-To: <161472735404.3478298.8179031068431918520.stgit@magnolia>

From: Darrick J. Wong <djwong@kernel.org>

This test creates an empty filesystem with rmap btrees enabled, and then
checks that GETFSMAP corresponds (roughly) with what we expect mkfs to
have written to the filesystem.

Unfortunately, the test's calculation for the number of "per-AG
metadata" extents is not quite correct.  For a filesystem with a
refcount btree, the rmapbt and agfl blocks will be reported separately,
but for non-reflink filesystems, GETFSMAP merges the records.

Since this test counts the number of records, fix the calculation.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 tests/xfs/271 |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)


diff --git a/tests/xfs/271 b/tests/xfs/271
index 48a3eb8f..35c23b84 100755
--- a/tests/xfs/271
+++ b/tests/xfs/271
@@ -38,6 +38,16 @@ _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.
+$XFS_INFO_PROG $SCRATCH_MNT | grep -q reflink=1
+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
@@ -48,7 +58,7 @@ _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 * 3)) 0 999999 -v
+_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


  parent reply	other threads:[~2021-03-03  0:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-02 23:22 [PATCHSET 0/4] fstests: various fixes Darrick J. Wong
2021-03-02 23:22 ` [PATCH 1/4] generic/623: don't fail on core dumps Darrick J. Wong
2021-03-04 14:41   ` Chandan Babu R
2021-03-05  8:30   ` Christoph Hellwig
2021-03-02 23:22 ` Darrick J. Wong [this message]
2021-03-04 15:42   ` [PATCH 2/4] xfs/271: fix test failure on non-reflink filesystems Chandan Babu R
2021-03-05  8:31   ` Christoph Hellwig
2021-03-02 23:22 ` [PATCH 3/4] common/rc: fix detection of device-mapper/persistent memory incompatibility Darrick J. Wong
2021-03-05  8:25   ` Chandan Babu R
2021-03-05  8:33   ` Christoph Hellwig
2021-03-02 23:22 ` [PATCH 4/4] generic/60[78]: ensure the initial DAX file flag state before test Darrick J. Wong
2021-03-05  8:35   ` Chandan Babu R

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=161472736521.3478298.1405183245326186350.stgit@magnolia \
    --to=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=guan@eryu.me \
    --cc=guaneryu@gmail.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).