btrfs-progs: tests: misc/058: reduce the space requirement and speed up the test

[BUG]
When I was testing misc/058, the fs still has around 7GiB free space,
but during that test case, btrfs kernel module reports write failures
and even git commands failed inside that fs.

And obviously the test case failed.

[CAUSE]
It turns out that, the test case itself would require 6GiB (4 data
disks) + 1.5GiB x 2 (the two replace target), thus it requires 9 GiB
free space.

And obviously my partition is not that large and failed.

[FIX]
In fact, we really don't need that much space at all.

The test verifies that two consecutive replace operations can be started
and enqueued, the sleep of 1 second is not strictly necessary as the
first command should start the replace right away.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Qu Wenruo 2023-08-08 14:55:21 +08:00 committed by David Sterba
parent 885fe371c8
commit e6b412b359

View File

@ -21,16 +21,15 @@ run_check_mount_test_dev
run_check $SUDO_HELPER "$TOP/btrfs" device remove "$REPLACE1" "$TEST_MNT"
run_check $SUDO_HELPER "$TOP/btrfs" device remove "$REPLACE2" "$TEST_MNT"
for i in `seq 48`; do
for i in `seq 16`; do
run_check $SUDO_HELPER dd if=/dev/zero of="$TEST_MNT/file$i" bs=1M count=128 status=noxfer
done
# Sync so replace start does not block in unwritten IO
run_check "$TOP/btrfs" filesystem sync "$TEST_MNT"
run_check "$TOP/btrfs" filesystem usage -T "$TEST_MNT"
# Go background, should not be that fast, estimated 10 seconds
# Go background, should not be that fast.
run_check $SUDO_HELPER "$TOP/btrfs" replace start 2 "$REPLACE1" "$TEST_MNT"
run_check sleep 1
# No background, should wait
run_check $SUDO_HELPER "$TOP/btrfs" replace start --enqueue 3 "$REPLACE2" "$TEST_MNT"
run_check $SUDO_HELPER "$TOP/btrfs" replace status "$TEST_MNT"