Skip to content

Commit 550f133

Browse files
adam900710kdave
authored andcommitted
btrfs: defrag: remove an ambiguous condition for rejection
From the very beginning of btrfs defrag, there is a check to reject extents which meet both conditions: - Physically adjacent We may want to defrag physically adjacent extents to reduce the number of extents or the size of subvolume tree. - Larger than 128K This may be there for compressed extents, but unfortunately 128K is exactly the max capacity for compressed extents. And the check is > 128K, thus it never rejects compressed extents. Furthermore, the compressed extent capacity bug is fixed by previous patch, there is no reason for that check anymore. The original check has a very small ranges to reject (the target extent size is > 128K, and default extent threshold is 256K), and for compressed extent it doesn't work at all. So it's better just to remove the rejection, and allow us to defrag physically adjacent extents. CC: stable@vger.kernel.org # 5.16 Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 979b25c commit 550f133

1 file changed

Lines changed: 0 additions & 4 deletions

File tree

fs/btrfs/ioctl.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,10 +1075,6 @@ static bool defrag_check_next_extent(struct inode *inode, struct extent_map *em,
10751075
*/
10761076
if (next->len >= get_extent_max_capacity(em))
10771077
goto out;
1078-
/* Physically adjacent and large enough */
1079-
if ((em->block_start + em->block_len == next->block_start) &&
1080-
(em->block_len > SZ_128K && next->block_len > SZ_128K))
1081-
goto out;
10821078
ret = true;
10831079
out:
10841080
free_extent_map(next);

0 commit comments

Comments
 (0)