All of lore.kernel.org
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] Revert "btrfs: compression: don't try to compress if we don't" failed to apply to 5.4-stable tree
@ 2021-08-29  6:54 gregkh
  2021-08-30 13:09 ` David Sterba
  0 siblings, 1 reply; 3+ messages in thread
From: gregkh @ 2021-08-29  6:54 UTC (permalink / raw)
  To: wqu, ce3g8jdj, dsterba; +Cc: stable


The patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 4e9655763b82a91e4c341835bb504a2b1590f984 Mon Sep 17 00:00:00 2001
From: Qu Wenruo <wqu@suse.com>
Date: Wed, 25 Aug 2021 13:41:42 +0800
Subject: [PATCH] Revert "btrfs: compression: don't try to compress if we don't
 have enough pages"

This reverts commit f2165627319ffd33a6217275e5690b1ab5c45763.

[BUG]
It's no longer possible to create compressed inline extent after commit
f2165627319f ("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: f2165627319f ("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>

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 06f9f167222b..bd5689fa290e 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -629,7 +629,7 @@ static noinline int compress_file_range(struct async_chunk *async_chunk)
 	 * inode has not been flagged as nocompress.  This flag can
 	 * change at any time if we discover bad compression ratios.
 	 */
-	if (nr_pages > 1 && inode_need_compress(BTRFS_I(inode), start, end)) {
+	if (inode_need_compress(BTRFS_I(inode), start, end)) {
 		WARN_ON(pages);
 		pages = kcalloc(nr_pages, sizeof(struct page *), GFP_NOFS);
 		if (!pages) {


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: FAILED: patch "[PATCH] Revert "btrfs: compression: don't try to compress if we don't" failed to apply to 5.4-stable tree
  2021-08-29  6:54 FAILED: patch "[PATCH] Revert "btrfs: compression: don't try to compress if we don't" failed to apply to 5.4-stable tree gregkh
@ 2021-08-30 13:09 ` David Sterba
  2021-09-01  8:18   ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: David Sterba @ 2021-08-30 13:09 UTC (permalink / raw)
  To: gregkh; +Cc: wqu, ce3g8jdj, dsterba, stable, linux-btrfs

On Sun, Aug 29, 2021 at 08:54:11AM +0200, gregkh@linuxfoundation.org wrote:
> 
> The patch below does not apply to the 5.4-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <stable@vger.kernel.org>.

The code in versions from 5.4 to 4.4 is the same and the merge conflict
can be resolved from that (eg. from file
stable.git/releases/./5.4.136/btrfs-compression-don-t-try-to-compress-if-we-don-t-have-enough-pages.patch)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: FAILED: patch "[PATCH] Revert "btrfs: compression: don't try to compress if we don't" failed to apply to 5.4-stable tree
  2021-08-30 13:09 ` David Sterba
@ 2021-09-01  8:18   ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2021-09-01  8:18 UTC (permalink / raw)
  To: dsterba, wqu, ce3g8jdj, dsterba, stable, linux-btrfs

On Mon, Aug 30, 2021 at 03:09:49PM +0200, David Sterba wrote:
> On Sun, Aug 29, 2021 at 08:54:11AM +0200, gregkh@linuxfoundation.org wrote:
> > 
> > The patch below does not apply to the 5.4-stable tree.
> > If someone wants it applied there, or to any other stable or longterm
> > tree, then please email the backport, including the original git commit
> > id to <stable@vger.kernel.org>.
> 
> The code in versions from 5.4 to 4.4 is the same and the merge conflict
> can be resolved from that (eg. from file
> stable.git/releases/./5.4.136/btrfs-compression-don-t-try-to-compress-if-we-don-t-have-enough-pages.patch)

I'm sorry, but I do not understand what you are trying to say here.
What exactly should I do?

confused,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-01  8:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-29  6:54 FAILED: patch "[PATCH] Revert "btrfs: compression: don't try to compress if we don't" failed to apply to 5.4-stable tree gregkh
2021-08-30 13:09 ` David Sterba
2021-09-01  8:18   ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.