[PATCH 2/2] btrfs-progs: mkfs-tests: Add test case to verify the --rootdir size limit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add a test case to ensure we can create a 350M fs with 128M rootdir.

Signed-off-by: Qu Wenruo <wqu@xxxxxxxx>
---
 tests/mkfs-tests/021-rootdir-size/test.sh | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100755 tests/mkfs-tests/021-rootdir-size/test.sh

diff --git a/tests/mkfs-tests/021-rootdir-size/test.sh b/tests/mkfs-tests/021-rootdir-size/test.sh
new file mode 100755
index 000000000000..064476fdc847
--- /dev/null
+++ b/tests/mkfs-tests/021-rootdir-size/test.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+# Regression test for mkfs.btrfs --rootdir with DUP data profile and rootdir
+# size near the limit of the device.
+#
+# There is a bug that makes mkfs.btrfs always to create unnecessary SINGLE
+# chunks, which eats up a lot of space and leads to unexpected ENOSPC bugs.
+
+source "$TEST_TOP/common"
+
+check_prereq mkfs.btrfs
+prepare_test_dev
+
+tmp=$(mktemp -d --tmpdir btrfs-progs-mkfs.rootdirXXXXXXX)
+
+fallocate -l 128M $tmp/large_file
+
+# We should be able to create the fs with size limit to 2 * (128 + 32 + 8)
+# which is 336M. Here we round it up to 350M.
+run_check "$TOP/mkfs.btrfs" -f --rootdir "$tmp" -d dup -b 350M "$TEST_DEV"
+run_check "$TOP/btrfs" check "$TEST_DEV"
+
+rm -rf -- "$tmp"
-- 
2.27.0




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux