btrfs: autodefrag with regular and hole extents
authorQu Wenruo <wqu@suse.com>
Fri, 28 Jan 2022 00:27:00 +0000 (08:27 +0800)
committerEryu Guan <guaneryu@gmail.com>
Sun, 13 Feb 2022 17:17:46 +0000 (01:17 +0800)
commit8925b0290ffe0744d28f99a0a38e92e46cb85d75
tree878f142875ce86528bfef114d6b75d19877d617d
parentd8639e1632ab3fe1d8044702699350ddf2499b12
btrfs: autodefrag with regular and hole extents

In v5.11~v5.15 kernels, there is a regression in autodefrag that if
a cluster (up to 256K in size) has even a single hole, the whole
cluster will be rejected.

This will greatly reduce the efficiency of autodefrag.

The behavior is fixed in v5.16 by a full rework, although the rework
itself has other problems, it at least solves the problem.

Here we add a test case to reproduce the case, where we have a 128K
cluster, the first half is fragmented extents which can be
defragged.  The second half is hole.

Make sure autodefrag can defrag the 64K part.

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/258 [new file with mode: 0755]
tests/btrfs/258.out [new file with mode: 0644]