aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2024-03-05 19:52:17 +0100
committerZorro Lang <zlang@kernel.org>2024-03-11 12:50:09 +0800
commit94937700f4ee0b7e9d993c40a69ccf4716d5e724 (patch)
tree4687ccc287724b139c8f055a55f9ef392cbfb788
parente990496ffc0954943987ddf845c09591db79d189 (diff)
downloadxfstests-dev-94937700f4ee0b7e9d993c40a69ccf4716d5e724.tar.gz
btrfs/271: adjust failure condition
btrfs/271 was failing with the subpage blocksize VM's. This is because there's an assumption made that the device error counters are per-sector, but they're per-io. With a 16kib pagesize and a 4k sectorsize/nodesize the threshold was expecting 16 failed IO's, but instead we were getting 5. This other gotcha here is that with the tree log we will write the log tree first, and then update the log root tree with the location of the log tree root node. With pagesize == nodesize this is fine, we will only write the log tree root node. However with subpage blocksize both of these nodes could be on the same page, and thus they are both written out during that initial write. When we update the pointer for the log root tree we will COW the log root tree root node and submit another IO, resulting in 3 metadata IO's instead of 2. Fix the failure case to be < 4 blocks, which is the minimum number of IO's we should be seeing. Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Anand Jain <anand.jain@oracle.com>
-rwxr-xr-xtests/btrfs/27111
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/btrfs/271 b/tests/btrfs/271
index 273799f179..a342af3aed 100755
--- a/tests/btrfs/271
+++ b/tests/btrfs/271
@@ -25,10 +25,6 @@ _scratch_mount
dev2=`echo $SCRATCH_DEV_POOL | $AWK_PROG '{print $2}'`
-pagesize=$(_get_page_size)
-blocksize=$(_get_block_size $SCRATCH_MNT)
-sectors_per_page=$(($pagesize / $blocksize))
-
_allow_fail_make_request
echo "Step 1: writing with one failing mirror:"
@@ -36,9 +32,14 @@ _bdev_fail_make_request $SCRATCH_DEV 1
$XFS_IO_PROG -f -c "pwrite -W -S 0xaa 0 8K" $SCRATCH_MNT/foobar | _filter_xfs_io
_bdev_fail_make_request $SCRATCH_DEV 0
+# btrfs counts errors per IO, assuming the data is merged that'll be 1 IO, then
+# the log tree block and then the log root tree block and then the super block.
+# We should see at least 4 failed IO's, but with subpage blocksize we could see
+# more if the log blocks end up on the same page, or if the data IO gets split
+# at all.
errs=$($BTRFS_UTIL_PROG device stats $SCRATCH_DEV | \
$AWK_PROG '/write_io_errs/ { print $2 }')
-if [ $errs -ne $((4 * $sectors_per_page)) ]; then
+if [ $errs -lt 4 ]; then
_fail "Errors: $errs expected: 4"
fi