[PATCH 5/5] btrfs/282: increase throttled scrub rate tolerance

David Disseldorp
2023-12-07T07:21:20Z

Even with dmdelay injected latencies, I still observe occasional test
failures on shared storage (e.g. VMs). The extra 10% tolerance resolves
these intermittent failures on my system.

Signed-off-by: David Disseldorp <ddiss@suse.de>
---
tests/btrfs/282 | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tests/btrfs/282 b/tests/btrfs/282
index 42d992a6..6649623a 100755
--- a/tests/btrfs/282
+++ b/tests/btrfs/282
@@ -95,9 +95,8 @@ speed=$($BTRFS_UTIL_PROG scrub status --raw $SCRATCH_MNT |\
tee -a $seqres.full |\
$AWK_PROG '$1 == "Rate:" {sub(/\/s/, "", $2); print $2}')

-# We gave a +- 10% tolerance for the throttle
-if [ "$speed" -gt "$(( $target_speed * 11 / 10 ))" -o \
- "$speed" -lt "$(( $target_speed * 9 / 10))" ]; then
+# We gave a +- 20% tolerance for the throttle
+if (( speed > target_speed * 12 / 10 || speed < target_speed * 8 / 10 )); then
echo "scrub speed $speed Bytes/s is not properly throttled, target is $target_speed Bytes/s"
fi

--
2.35.3