]> git.baikalelectronics.ru Git - kernel.git/commit
Revert "btrfs: compression: don't try to compress if we don't have enough pages"
authorQu Wenruo <wqu@suse.com>
Wed, 25 Aug 2021 05:41:42 +0000 (13:41 +0800)
committerDavid Sterba <dsterba@suse.com>
Wed, 25 Aug 2021 13:08:19 +0000 (15:08 +0200)
commit3df682f460c9f10514972f2f0fe6dfd598e2464c
treede206c8bef5e96ed7236c597a8f83759cfd943d0
parent0f8064f706c5a15b6bfd5140308d7d46094b3a76
Revert "btrfs: compression: don't try to compress if we don't have enough pages"

This reverts commit 0f2073e7c10a189062cf728c0c29d8ef4ae52b8c.

[BUG]
It's no longer possible to create compressed inline extent after commit
0f2073e7c10a ("btrfs: compression: don't try to compress if we don't
have enough pages").

[CAUSE]
For compression code, there are several possible reasons we have a range
that needs to be compressed while it's no more than one page.

- Compressed inline write
  The data is always smaller than one sector and the test lacks the
  condition to properly recognize a non-inline extent.

- Compressed subpage write
  For the incoming subpage compressed write support, we require page
  alignment of the delalloc range.
  And for 64K page size, we can compress just one page into smaller
  sectors.

For those reasons, the requirement for the data to be more than one page
is not correct, and is already causing regression for compressed inline
data writeback.  The idea of skipping one page to avoid wasting CPU time
could be revisited in the future.

[FIX]
Fix it by reverting the offending commit.

Reported-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
Link: https://lore.kernel.org/linux-btrfs/afa2742.c084f5d6.17b6b08dffc@tnonline.net
Fixes: 0f2073e7c10a ("btrfs: compression: don't try to compress if we don't have enough pages")
CC: stable@vger.kernel.org # 4.4+
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c