Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3389198pxj; Sun, 20 Jun 2021 19:42:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhvJFmookGa/ETRO9Tueq/qD0slAhIuwmFub+UstOsbw5VxJazXHnGBahli8aHrg7y3ttV X-Received: by 2002:a17:906:cc9b:: with SMTP id oq27mr22207467ejb.301.1624243336635; Sun, 20 Jun 2021 19:42:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624243336; cv=none; d=google.com; s=arc-20160816; b=hZA4ljjeZh0t2289ZykfBxR5tYwYjgKuhTF0m2LNF8Md98cZIMGOVktubt0FUQR9q4 JKmBZEUxTWlRWoo1TYv5l6pC5zykEBTQ8uJ5LPwP0R2v08bnQnhz6ZE4ZBlXWBrohSZO ryH90CGIUeYBIpwazWfZjhe2qya0ByUaLDRkcu4+0phlZ0dClumvJ8JXsys1WsK3VaKM g/GsIltDg4aOqOK2DS3qzMMckhHkkL+1ttUuv9F9wTxYLZD6JE9NPfFwkO8Q73frdsiU f9DlAJyztB73BaXWgsXiRGvTVPVjn/of98ckdG4tsJ9tRC4T54hOrrTyX2XO5A9vKS6b T/VA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=JgjIeekDbanTO+e1c9pWtywPrBcSZp7nltvbQa4+mmQ=; b=dXFgrQuUOufGmw4sTyh4DtvLEK/GOfHprIURv1HWaQvLGMxUhW5Wq4Lj8Dx+2Ca3dq /4R6LONbci3aFZJq2OhK03z3q4K1mX2CdDxx8fQE2U6Mt+94ndlOKLdxmopAbCBqCThE sfkUa6MbscxP3taai4OXCB3IhFS4vCoMrevDJatM0N7ckT9/h5suOHWYM3CeKaLOvx6L VfwYDPJfxTj+Di5qRHBCUHypBhLqk0NytQbKwQk2EDWm6vSc4dDcElT7grg6PwKM6L31 4EOaBvOthvA8FVnZxZta4SZ82BfjB3Qg6R6kPITWd8ESMxDRiEjD2rmNN6i9B/b1a64q BV5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CZv9pbMW; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t9si12292453edd.407.2021.06.20.19.41.54; Sun, 20 Jun 2021 19:42:16 -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=@kernel.org header.s=k20201202 header.b=CZv9pbMW; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230040AbhFUCmn (ORCPT + 99 others); Sun, 20 Jun 2021 22:42:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:57022 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229899AbhFUCmm (ORCPT ); Sun, 20 Jun 2021 22:42:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4A9506117A; Mon, 21 Jun 2021 02:40:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624243229; bh=kvA/863X51D5uuCExsqTAZJw9OimySqMMSVIU2Op2YE=; h=From:To:Cc:Subject:Date:From; b=CZv9pbMWPrzni0vevDUjAs3JnoDYWodl76e62ay6jo0FyyVcun5R/YRxyneOIAngX zKRoNdMairPxKeihcsJa7McHeMdVuEHPzjQ/Wywt/afdKsyZg9HglfxXvDnY04oHUm OHyqeWq3uG1P4GXh9djNKNsOYYD2FXdxYlPoYviW6utjMIoxWvQ2EaTGe+zRGCuHHV KZXGnYw4FfgD3tCq/vd4pXmV1KIL3vjEAcwRXZzjLOX9CjwSBzazEIJMgh8CGhgj1q sHLoTnmChbrJrROcL8OmY/XEHSMnkeENN+h90537IrgNw7XognJLWTGCmH2QMhUyca aBk07OdNgHKyA== From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: Daeho Jeong , Jaegeuk Kim Subject: [PATCH] f2fs: enable extent cache for compression files in read-only Date: Sun, 20 Jun 2021 19:40:27 -0700 Message-Id: <20210621024027.1511092-1-jaegeuk@kernel.org> X-Mailer: git-send-email 2.32.0.288.g62a8d224e6-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Daeho Jeong Let's allow extent cache for RO partition. Signed-off-by: Daeho Jeong Signed-off-by: Jaegeuk Kim --- fs/f2fs/f2fs.h | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index d84e78dabdbe..16ce1ade9fa6 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -3148,25 +3148,6 @@ static inline bool is_dot_dotdot(const u8 *name, size_t len) return false; } -static inline bool f2fs_may_extent_tree(struct inode *inode) -{ - struct f2fs_sb_info *sbi = F2FS_I_SB(inode); - - if (!test_opt(sbi, EXTENT_CACHE) || - is_inode_flag_set(inode, FI_NO_EXTENT) || - is_inode_flag_set(inode, FI_COMPRESSED_FILE)) - return false; - - /* - * for recovered files during mount do not create extents - * if shrinker is not registered. - */ - if (list_empty(&sbi->s_list)) - return false; - - return S_ISREG(inode->i_mode); -} - static inline void *f2fs_kmalloc(struct f2fs_sb_info *sbi, size_t size, gfp_t flags) { @@ -4201,6 +4182,26 @@ F2FS_FEATURE_FUNCS(casefold, CASEFOLD); F2FS_FEATURE_FUNCS(compression, COMPRESSION); F2FS_FEATURE_FUNCS(readonly, RO); +static inline bool f2fs_may_extent_tree(struct inode *inode) +{ + struct f2fs_sb_info *sbi = F2FS_I_SB(inode); + + if (!test_opt(sbi, EXTENT_CACHE) || + is_inode_flag_set(inode, FI_NO_EXTENT) || + (is_inode_flag_set(inode, FI_COMPRESSED_FILE) && + !f2fs_sb_has_readonly(sbi))) + return false; + + /* + * for recovered files during mount do not create extents + * if shrinker is not registered. + */ + if (list_empty(&sbi->s_list)) + return false; + + return S_ISREG(inode->i_mode); +} + #ifdef CONFIG_BLK_DEV_ZONED static inline bool f2fs_blkz_is_seq(struct f2fs_sb_info *sbi, int devi, block_t blkaddr) -- 2.32.0.288.g62a8d224e6-goog