btrfs: defrag: remove an ambiguous condition for rejection
authorQu Wenruo <wqu@suse.com>
Fri, 28 Jan 2022 07:21:22 +0000 (15:21 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 14 Feb 2022 18:20:44 +0000 (19:20 +0100)
commit3086126664eef0424fa5680d058d8abccc465455
treee26d27c04b42dd91c5852b9dbf552a9abfdf94c1
parentc55eaee8366f0b9ba9d62c8716c2a72c75e4a1af
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.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ioctl.c