From nobody Sun Feb 8 09:34:48 2026 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 C702EC77B61 for ; Thu, 13 Apr 2023 09:22:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229949AbjDMJWw (ORCPT ); Thu, 13 Apr 2023 05:22:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229482AbjDMJWv (ORCPT ); Thu, 13 Apr 2023 05:22:51 -0400 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03B82E9 for ; Thu, 13 Apr 2023 02:22:49 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R201e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=3;SR=0;TI=SMTPD_---0Vg-sT3G_1681377761; Received: from e18g06460.et15sqa.tbsite.net(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0Vg-sT3G_1681377761) by smtp.aliyun-inc.com; Thu, 13 Apr 2023 17:22:47 +0800 From: Gao Xiang To: linux-erofs@lists.ozlabs.org Cc: LKML , Gao Xiang Subject: [PATCH v2] erofs: get rid of z_erofs_fill_inode() Date: Thu, 13 Apr 2023 17:22:41 +0800 Message-Id: <20230413092241.73829-1-hsiangkao@linux.alibaba.com> X-Mailer: git-send-email 2.24.4 In-Reply-To: <20230411101045.35762-1-hsiangkao@linux.alibaba.com> References: <20230411101045.35762-1-hsiangkao@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Prior to big pclusters, non-compact compression indexes could have empty headers. Let's just avoid the legacy path since it can be handled properly as a specific compression header with z_erofs_fill_inode_lazy() too. Tested with erofs-utils exist versions. Signed-off-by: Gao Xiang Reviewed-by: Chao Yu Reviewed-by: Yue Hu --- changes since v1: - fix up build errors without compression. fs/erofs/inode.c | 12 ++++++++---- fs/erofs/internal.h | 2 -- fs/erofs/zmap.c | 18 ------------------ 3 files changed, 8 insertions(+), 24 deletions(-) diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c index 7ca9aafb7471..e196d453291b 100644 --- a/fs/erofs/inode.c +++ b/fs/erofs/inode.c @@ -291,11 +291,15 @@ static int erofs_fill_inode(struct inode *inode) } =20 if (erofs_inode_is_data_compressed(vi->datalayout)) { +#ifdef CONFIG_EROFS_FS_ZIP if (!erofs_is_fscache_mode(inode->i_sb) && - inode->i_sb->s_blocksize_bits =3D=3D PAGE_SHIFT) - err =3D z_erofs_fill_inode(inode); - else - err =3D -EOPNOTSUPP; + inode->i_sb->s_blocksize_bits =3D=3D PAGE_SHIFT) { + inode->i_mapping->a_ops =3D &z_erofs_aops; + err =3D 0; + goto out_unlock; + } +#endif + err =3D -EOPNOTSUPP; goto out_unlock; } inode->i_mapping->a_ops =3D &erofs_raw_access_aops; diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index f675050af2bb..f1268cb6a37c 100644 --- a/fs/erofs/internal.h +++ b/fs/erofs/internal.h @@ -522,7 +522,6 @@ int erofs_try_to_free_cached_page(struct page *page); int z_erofs_load_lz4_config(struct super_block *sb, struct erofs_super_block *dsb, struct z_erofs_lz4_cfgs *lz4, int len); -int z_erofs_fill_inode(struct inode *inode); int z_erofs_map_blocks_iter(struct inode *inode, struct erofs_map_blocks *= map, int flags); #else @@ -542,7 +541,6 @@ static inline int z_erofs_load_lz4_config(struct super_= block *sb, } return 0; } -static inline int z_erofs_fill_inode(struct inode *inode) { return -EOPNOT= SUPP; } #endif /* !CONFIG_EROFS_FS_ZIP */ =20 #ifdef CONFIG_EROFS_FS_ZIP_LZMA diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c index 7ca108c3834c..14c21284d019 100644 --- a/fs/erofs/zmap.c +++ b/fs/erofs/zmap.c @@ -7,24 +7,6 @@ #include #include =20 -int z_erofs_fill_inode(struct inode *inode) -{ - struct erofs_inode *const vi =3D EROFS_I(inode); - struct erofs_sb_info *sbi =3D EROFS_SB(inode->i_sb); - - if (!erofs_sb_has_big_pcluster(sbi) && - !erofs_sb_has_ztailpacking(sbi) && !erofs_sb_has_fragments(sbi) && - vi->datalayout =3D=3D EROFS_INODE_COMPRESSED_FULL) { - vi->z_advise =3D 0; - vi->z_algorithmtype[0] =3D 0; - vi->z_algorithmtype[1] =3D 0; - vi->z_logical_clusterbits =3D inode->i_sb->s_blocksize_bits; - set_bit(EROFS_I_Z_INITED_BIT, &vi->flags); - } - inode->i_mapping->a_ops =3D &z_erofs_aops; - return 0; -} - struct z_erofs_maprecorder { struct inode *inode; struct erofs_map_blocks *map; --=20 2.24.4