diff mbox series

[2/2] btrfs-progs: mkfs-tests: add test case to make sure we don't create bitmaps for empty fs

Message ID 0333d0b18d0fa0ddfafe7b13a40c4e43e3c8928f.1653009947.git.wqu@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: free space tree fixes | expand

Commit Message

Qu Wenruo May 20, 2022, 1:31 a.m. UTC
The new test case is to make sure on a relative large empty fs, we won't
create bitmaps to unnecessarily bump up the size of free space tree.

Signed-off-by: Qu Wenruo <wqu@suse.com>
 tests/mkfs-tests/024-fst-bitmaps/test.sh | 35 ++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100755 tests/mkfs-tests/024-fst-bitmaps/test.sh
diff mbox series


diff --git a/tests/mkfs-tests/024-fst-bitmaps/test.sh b/tests/mkfs-tests/024-fst-bitmaps/test.sh
new file mode 100755
index 000000000000..8d88c08cb25a
--- /dev/null
+++ b/tests/mkfs-tests/024-fst-bitmaps/test.sh
@@ -0,0 +1,35 @@ 
+# Basic check if mkfs supports the runtime feature free-space-tree
+source "$TEST_TOP/common"
+check_prereq mkfs.btrfs
+check_prereq btrfs
+setup_loopdevs 4
+tmp=$(_mktemp fst-bitmap)
+	run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$@"
+	if run_check_stdout "$TOP/btrfs" check "$dev1" | grep -iq warning; then
+		_fail "warnings found in check output"
+	fi
+test_do_mkfs -m raid1 -d raid0 ${loopdevs[@]}
+run_check_stdout $SUDO_HELPER "$TOP/btrfs" inspect-internal dump-tree \
+	-t free_space "$dev1" > "$tmp.dump-tree"
+if grep -q FREE_SPACE_BITMAP "$tmp.dump-tree"; then
+	rm -f -- "$tmp*"
+	_fail "free space bitmap should not be created for empty fs"
+rm -f -- "$tmp*"