@@ -10,6 +10,13 @@ setup_root_helper
prepare_test_dev
check_kernel_support_acl
+# Extra finetunes to make btrfs-convert to commit transaction for each copied
+# inode, and keep cached tree blocks to minimal.
+# This is to ensure tree-checker is triggered for as many tree blocks as
+# possible, and expose any bad convert metadata behavior.
+export BTRFS_PROGS_DEBUG_BLOCKS_USED_THRESHOLD=16K
+export BTRFS_PROGS_DEBUG_METADATA_CACHE_SIZE=16K
+
# Iterate over defaults and options that are not tied to hardware capabilities
# or number of devices
for feature in '' 'block-group-tree' ; do
@@ -10,6 +10,13 @@ setup_root_helper
prepare_test_dev
check_kernel_support_acl
+# Extra finetunes to make btrfs-convert to commit transaction for each copied
+# inode, and keep cached tree blocks to minimal.
+# This is to ensure tree-checker is triggered for as many tree blocks as
+# possible, and expose any bad convert metadata behavior.
+export BTRFS_PROGS_DEBUG_BLOCKS_USED_THRESHOLD=16K
+export BTRFS_PROGS_DEBUG_METADATA_CACHE_SIZE=16K
+
# Iterate over defaults and options that are not tied to hardware capabilities
# or number of devices
for feature in '' 'block-group-tree' ; do
Inspired by a recent bug report where a large ext4 fs can lead to tree-checker warning on bad previous key objectid, we need a way to trigger tree-checker more frequently to shake out hidden bugs. This patch would set blocks_used threshold of btrfs-convert to 16K, and global metadata cache size to 16K (instead of 1/4 of total memory) for convert-tests/001 and convert-tests/003. With those two small values, it's already enough to trigger the bad previous key objectid bugs (without the proper fixes): [TEST/conv] 001-ext2-basic [TEST/conv] ext2 4k nodesize, btrfs defaults failed: /home/adam/btrfs-progs/btrfs-convert -N 4096 /home/adam/btrfs-progs/tests/test.img test failed for case 001-ext2-basic And the failure is exactly the reported one: Create ext2 image file Create btrfs metadata Copy inodes [o] [ 0/ 529] corrupt leaf: root=5 block=147079168 slot=25 ino=267, invalid previous key objectid, have 266 expect 267 Signed-off-by: Qu Wenruo <wqu@suse.com> --- tests/convert-tests/001-ext2-basic/test.sh | 7 +++++++ tests/convert-tests/003-ext4-basic/test.sh | 7 +++++++ 2 files changed, 14 insertions(+)