Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1003363pxb; Wed, 1 Sep 2021 15:02:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwrf/JH9fn36UEuMKynAXKReQLvMjLSdb0LOadS+DEDmd6Zl47pwFqPRY6UL8BNWYIYfaep X-Received: by 2002:a92:7b0c:: with SMTP id w12mr1152536ilc.307.1630533762510; Wed, 01 Sep 2021 15:02:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630533762; cv=none; d=google.com; s=arc-20160816; b=v6cuwBhnoovAxf73uDSPW+FHtYcRzhiUgNadigucNqTadZ2p9i/vWOSVfxV+mPxZ7u ohDfkhLPFJlt1aSfSAyJ41FdqTgVefT6EN+8hO746qoHYOf59b8WNC+lW9Dl3YnqibnV Rf/wCMagiADLaEQsTzEtcEzhrFucMlYwBVcWIvVs3fL6wiL476ksJ3yF1+mJOFC5j4Or 1Rj0Ur/Y6ErAWmFr5XSQaOj9v4eGbzzRRigK7buvAoAwUFh9ceH5jsK1scTvwwXI+IQz ZD5c8riD/efs/7ePXya+QjeeJC4X54hTcacvxpdvrFZ4EPII78ulCicpfE6Ynl+1mAku arwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9s6wLBPfqC0ZlXl8j+KQcysMxEhUPpsme6F559TjCpM=; b=Dt5TFgI3hWlNCZxRAaz8qkx1cWGBV8aG719WuASeZhpY3MJaiy3OCUUsyARmkAm2SA 4L1UtIdKsE22obOUKDkyYiKksPJCadFqMrb8uEtwiSajOVEA1uEsY0932OheCnq0DgzA G0vPJTh0Zqvv7i1m3qfYRgDmHFV1gVezgdOhIvhlcop2y44xuj9v48cB+VPXH2lzAas3 6ekrDkSZRE9LQOBIoFBIOa0VWwa83dDLqcR4ZNeAzJ5Yk9MD8NkCDpbm6W50FdCK2z9/ m/vIKW0edyq9nBFilUovrNdFgfuamT0SxOhDgB7CU5WgzD3IPTiQ2cCCWP8dXT6mOh7g z5LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=q4GxxdDC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b60si728883jai.29.2021.09.01.15.02.29; Wed, 01 Sep 2021 15:02:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=q4GxxdDC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244991AbhIAMhg (ORCPT + 99 others); Wed, 1 Sep 2021 08:37:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:34434 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343566AbhIAMgC (ORCPT ); Wed, 1 Sep 2021 08:36:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F033661090; Wed, 1 Sep 2021 12:33:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1630499604; bh=LpVbVT5UPCEoz8bnrnxcToj1FZ2Pxvrd8UXF5JNzSio=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q4GxxdDCgSlw/sLGo5zwbS+nq4engvp9oDcrSFMPk4ByDKVAevm8lQTBP8MW/vy94 khXgu5DUpdakq9F5bAxD2+l7+KLfF1HL4b0HPlHqadOUmGp1+ybN7hBXddaQpCQjy2 nzGc6JqDLzLrQPgbbW5R/m0iz26XITsiMxF3Ravg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zygo Blaxell , Qu Wenruo , David Sterba Subject: [PATCH 5.10 015/103] Revert "btrfs: compression: dont try to compress if we dont have enough pages" Date: Wed, 1 Sep 2021 14:27:25 +0200 Message-Id: <20210901122301.043928981@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210901122300.503008474@linuxfoundation.org> References: <20210901122300.503008474@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Qu Wenruo commit 4e9655763b82a91e4c341835bb504a2b1590f984 upstream. 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 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 Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -547,7 +547,7 @@ again: * 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) {