btrfs-progs: tests: update fsck/012-leaf-corruption image

The image used in 012 has several problems:

- Bad dev_item total_bytes in superblock
    dev_item.total_bytes    20918272
    dev_item.bytes_used     67108864

  The fs has 64M chunks allocated, and the original fs is also 64M.
  Thus the total_bytes is completely wrong.

- Bad total_bytes in chunk tree
          item 0 key (DEV_ITEMS DEV_ITEM 1) itemoff 3897 itemsize 98
                devid 1 total_bytes 20918272 bytes_used 67108864
  The same problem as super block.

This problem is covered by btrfs-image, as it will recalculate the
device size.

However if btrfs-image is doing exactly same data replay without any
modification, such bad image would cause test failure, as we're unable
to fix such bad total_bytes.

This patch will update the image to fix such problem.
Also since we're here, there is no need to use custom .tar.gz image, as
we have extra_image() to handle the uncompression.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Qu Wenruo 2020-05-27 16:35:18 +08:00 committed by David Sterba
parent 71d02f90e7
commit 2f8071b6d3
3 changed files with 5 additions and 12 deletions

Binary file not shown.

View File

@ -37,11 +37,6 @@ leaf_no_data_ext_list=(
generate_leaf_corrupt_no_data_ext()
{
dest=$1
_log "generating leaf_corrupt_no_data_ext.btrfs-image"
tar --no-same-owner -xJf ./no_data_extent.tar.xz || \
_fail "failed to extract leaf_corrupt_no_data_ext.btrfs-image"
"$TOP/btrfs-image" -r test.img.btrfs-image "$dest" || \
_fail "failed to extract leaf_corrupt_no_data_ext.btrfs-image"
# leaf at 4206592 and 20905984 contains no regular data
# extent, clear its csum to corrupt the leaf.
@ -107,11 +102,9 @@ check_leaf_corrupt_no_data_ext()
setup_root_helper
generate_leaf_corrupt_no_data_ext test.img
check_image test.img
check_leaf_corrupt_no_data_ext test.img
image=$(extract_image ./good.img.xz)
generate_leaf_corrupt_no_data_ext "$image"
check_image "$image"
check_leaf_corrupt_no_data_ext "$image"
rm test.img
rm test.img.btrfs-image
# Not used, its function is the same as generate_leaf_corrupt_no_data_ext()
rm generate_image.sh
rm -- "$image"