btrfs: trim adjacent extents across adjacent block groups boundary
authorQu Wenruo <wqu@suse.com>
Thu, 24 Oct 2019 10:16:29 +0000 (18:16 +0800)
committerEryu Guan <guaneryu@gmail.com>
Sat, 26 Oct 2019 01:04:26 +0000 (09:04 +0800)
commit24f2c46da114fa44e3e90d6e51637c0b9a6cac26
tree83ecb98381abdefa7d1d0eb9450c83fa1fe05e59
parent4bd44aa86be6696f07785fef897006831d40ed3b
btrfs: trim adjacent extents across adjacent block groups boundary

The test case checks if btrfs can trim adjacent extents across
adjacent block groups boundary correctly.

The test case craft the following extents layout:

         |  BG1 |      BG2        |       BG3            |
 Bytenr: X-8M   X      X+512M     X+1G  X+1G+128M
         |//////|//////|          |     |//|

There is a long existing bug that, when btrfs is trying to trim the
range at [X+512M, X+1G+128M), it will only trim [X+512M, X+1G).

This test case is the regression test for this long existing bug.

It will verify the trimmed bytes by using loopback device backed up
by a file, and checking the bytes used by the file to determine how
many bytes are trimmed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/btrfs/199 [new file with mode: 0755]
tests/btrfs/199.out [new file with mode: 0644]
tests/btrfs/group