Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FB1BC433F5 for ; Thu, 16 Dec 2021 09:21:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235217AbhLPJVt (ORCPT ); Thu, 16 Dec 2021 04:21:49 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:57602 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235166AbhLPJVs (ORCPT ); Thu, 16 Dec 2021 04:21:48 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EF9E161CEA for ; Thu, 16 Dec 2021 09:21:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73BA9C36AE2; Thu, 16 Dec 2021 09:21:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1639646507; bh=tzWUoBZu6KNUUnzAoW8OFL7Sa0PqRes0tnj2oCB60S4=; h=From:To:Cc:Subject:Date:From; b=FVOl0Djy+1dkAYkfmwBnhdKzO3GX1UtE8jtEhj1npdu0jkt44isid8TNH//5AQxnm qyfuj3LenlnscPFcbADLqLR3E3TyYAekRWigvRdbDbieUroC8IYByznNam4isnKMdj ld8U5w9s/1f5yQkPUtDJrdllZhXhfSKOEX80XB4EZD0mwofMM7sRFU6vLW97dw838S nj7OxNco6ZjS+1bsIKkF4jTsr+nzr1XMTDdG4wPLF7fSIKxWPxYNDq7z7kxZw+oMrI FI2KtCBMIpZaFMAf1KcdBG4IqtdINHNpOXeWrcMWboEEziOx82jXm8U3yFa71S0EaU MoIHeKrVdNwtA== From: Chao Yu To: jaegeuk@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Chao Yu Subject: [PATCH v2] f2fs: don't drop compressed page cache in .{invalidate,release}page Date: Thu, 16 Dec 2021 17:13:56 +0800 Message-Id: <20211216091356.6643-1-chao@kernel.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For compressed inode, in .{invalidate,release}page, we will call f2fs_invalidate_compress_pages() to drop all compressed page cache of current inode. But we don't need to drop compressed page cache synchronously in .invalidatepage, because, all trancation paths of compressed physical block has been covered with f2fs_invalidate_compress_page(). And also we don't need to drop compressed page cache synchronously in .releasepage, because, if there is out-of-memory, we can count on page cache reclaim on sbi->compress_inode. BTW, this patch may fix the issue reported below: https://lore.kernel.org/linux-f2fs-devel/20211202092812.197647-1-changfengnan@vivo.com/T/#u Signed-off-by: Chao Yu --- v2: - fix compile error. fs/f2fs/data.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 2737fcc0dbcf..0fc6e0245732 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -3528,12 +3528,9 @@ void f2fs_invalidate_page(struct page *page, unsigned int offset, clear_page_private_gcing(page); - if (test_opt(sbi, COMPRESS_CACHE)) { - if (f2fs_compressed_file(inode)) - f2fs_invalidate_compress_pages(sbi, inode->i_ino); - if (inode->i_ino == F2FS_COMPRESS_INO(sbi)) - clear_page_private_data(page); - } + if (test_opt(sbi, COMPRESS_CACHE) && + inode->i_ino == F2FS_COMPRESS_INO(sbi)) + clear_page_private_data(page); if (page_private_atomic(page)) return f2fs_drop_inmem_page(inode, page); @@ -3553,12 +3550,9 @@ int f2fs_release_page(struct page *page, gfp_t wait) return 0; if (test_opt(F2FS_P_SB(page), COMPRESS_CACHE)) { - struct f2fs_sb_info *sbi = F2FS_P_SB(page); struct inode *inode = page->mapping->host; - if (f2fs_compressed_file(inode)) - f2fs_invalidate_compress_pages(sbi, inode->i_ino); - if (inode->i_ino == F2FS_COMPRESS_INO(sbi)) + if (inode->i_ino == F2FS_COMPRESS_INO(F2FS_I_SB(inode))) clear_page_private_data(page); } -- 2.32.0