Skip to content

Commit 7aa089a

Browse files
adam900710kdave
authored andcommitted
btrfs-progs: tests: add image for btrfstune bgt conversion
The image has a half converted fs, unfortunately btrfs-image cannot properly maintain the CHANGING_BG_TREE super block flags, thus we have to go raw image. The half-converted image has the following two block groups in the extent tree: item 0 key (1048576 BLOCK_GROUP_ITEM 4194304) itemoff 3971 itemsize 24 block group used 4096 chunk_objectid 256 flags SYSTEM|single item 2 key (5242880 BLOCK_GROUP_ITEM 8388608) itemoff 3914 itemsize 24 block group used 401408 chunk_objectid 256 flags METADATA|single And the following block groups in the block group tree: item 0 key (13631488 BLOCK_GROUP_ITEM 8388608) itemoff 3971 itemsize 24 block group used 8388608 chunk_objectid 256 flags DATA|single item 1 key (22020096 BLOCK_GROUP_ITEM 67108864) itemoff 3947 itemsize 24 block group used 66584576 chunk_objectid 256 flags DATA|single item 2 key (89128960 BLOCK_GROUP_ITEM 67108864) itemoff 3923 itemsize 24 block group used 59244544 chunk_objectid 256 flags DATA|single This in layout in fact is pretty good, as if by somehow the block group items loading bug skipped any block group, it will cause the fs to have no SYSTEM or METADATA space type. Unpatched btrfstune have a very high chance to cause the following error: ERROR: unable to find block group for profile 0x4 Unable to find block group for 0 Unable to find block group for 0 Unable to find block group for 0 Unable to find block group for 0 Unable to find block group for 0 Unable to find block group for 0 ERROR: failed to commit transaction for the new chunk: No space left on device ERROR: failed to start transaction: No space left on device ERROR: failed to convert the filesystem to block group tree feature ERROR: btrfstune failed extent buffer leak: start 5308416 len 4096 Signed-off-by: Qu Wenruo <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent be10126 commit 7aa089a

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed
Binary file not shown.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
# To check if btrfstune can handle half converted fs.
3+
#
4+
# Due to a bug in the block group items loading code, old block groups items
5+
# in the old extent tree can be skipped, thus causing resume failure.
6+
7+
source "$TEST_TOP/common" || exit
8+
9+
check_prereq btrfs
10+
11+
check_image() {
12+
run_check "$TOP/btrfstune" --convert-to-block-group-tree "$1"
13+
}
14+
15+
check_all_images

0 commit comments

Comments
 (0)