btrfs-progs: test/fsck: Introduce test images containing tree reloc tree
PATCH v2 1/3 btrfs-progs: test/fsck: Introduce test images containing tree reloc tree
Tree reloc tree is a special tree with very short life spawn. It acts as a special snapshot for any tree, with related nodes/leaves or EXTENT_DATA modified to point to new position.
Considering the short life spawn and its specialness, it should be quite reasonable to keep them as both corner case for fsck and educational dump for anyone interested in relocation.
---
v2:
Use check_image() override other than custom check function. Suggested by David.
--- tests/fsck-tests/027-tree-reloc-tree/test.sh | 19 +++++++++++++++++++ .../tree_reloc_for_data_reloc.img.xz | Bin 0 -> 2112 bytes .../tree_reloc_for_fs_tree.img.xz | Bin 0 -> 2424 bytes 3 files changed, 19 insertions(+) create mode 100755 tests/fsck-tests/027-tree-reloc-tree/test.sh create mode 100644 tests/fsck-tests/027-tree-reloc-tree/tree_reloc_for_data_reloc.img.xz create mode 100644 tests/fsck-tests/027-tree-reloc-tree/tree_reloc_for_fs_tree.img.xz
tests/fsck-tests/027-tree-reloc-tree/test.sh new file +19 -0
@@ -0,0 +1,19 @@ +#!/bin/bash +# Make sure btrfs check won't report any false alert for valid image with +# tree reloc tree. +# +# Also due to the short life spawn of tree reloc tree, save them as dump +# example for later usage. + +source "$TOP/tests/common" + +check_prereq btrfs + +check_image() { + local image + + image=$1 + run_check "$TOP/btrfs" check "$image" +} + +check_all_images
tests/fsck-tests/027-tree-reloc-tree/tree_reloc_for_data_reloc.img.xz new file binary +0 -0
tests/fsck-tests/027-tree-reloc-tree/tree_reloc_for_fs_tree.img.xz new file binary +0 -0
Signature · 1 line
2.15.0
PATCH 2/3 btrfs-progs: test/fsck/020: Cleanup custom check function by overriding check_image function
--- tests/fsck-tests/020-extent-ref-cases/test.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
tests/fsck-tests/020-extent-ref-cases/test.sh +6 -7
@@ -19,12 +19,11 @@ source "$TOP/tests/common" check_prereq btrfs -for img in *.img *.raw.xz -do - image=$(extract_image "$img") +check_image() { + local image - # Since the return value bug is already fixed, we don't need - # the old grep hack to detect bug. + image=$1 run_check "$TOP/btrfs" check "$image" - rm -f "$image" -done +} + +check_all_images
Signature · 1 line
2.15.0
PATCH 3/3 btrfs-progs: test/fsck/021: Cleanup custom check by overriding check_image
In reply to Qu Wenruo--- .../fsck-tests/021-partially-dropped-snapshot-case/test.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
tests/fsck-tests/021-partially-dropped-snapshot-case/test.sh +9 -5
@@ -5,14 +5,18 @@ source "$TOP/tests/common" check_prereq btrfs -for img in *.img -do - image=$(extract_image "$img") +check_image() +{ + local image + + image=$1 + run_check_stdout "$TOP/btrfs" check "$image" 2>&1 | grep -q "Errors found in extent allocation tree or chunk allocation" if [ $? -eq 0 ]; then rm -f "$image" _fail "unexpected error occurred when checking $img" fi - rm -f "$image" -done +} + +check_all_images
Signature · 1 line
2.15.0
Quoted 9 lines · Qu Wenruo
Tree reloc tree is a special tree with very short life spawn. It acts as a special snapshot for any tree, with related nodes/leaves or
EXTENT_DATAmodified to point to new position.Considering the short life spawn and its specialness, it should be quite reasonable to keep them as both corner case for fsck and educational dump for anyone interested in relocation.
Signed-off-by Qu Wenruo <[email protected]>
1-3 applied, thanks.