From nobody Fri Sep 19 02:32:29 2025 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 054C3C433FE for ; Wed, 30 Nov 2022 06:05:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233896AbiK3GFE (ORCPT ); Wed, 30 Nov 2022 01:05:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230033AbiK3GFA (ORCPT ); Wed, 30 Nov 2022 01:05:00 -0500 Received: from out30-56.freemail.mail.aliyun.com (out30-56.freemail.mail.aliyun.com [115.124.30.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6823837218 for ; Tue, 29 Nov 2022 22:04:59 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R131e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046056;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0VW1iHGt_1669788295; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0VW1iHGt_1669788295) by smtp.aliyun-inc.com; Wed, 30 Nov 2022 14:04:56 +0800 From: Jingbo Xu To: xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH v2] erofs: enable large folios for iomap mode Date: Wed, 30 Nov 2022 14:04:55 +0800 Message-Id: <20221130060455.44532-1-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.6.gb485710b 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" Enable large folios for iomap mode. Then the readahead routine will pass down large folios containing multiple pages. Let's enable this for non-compressed format for now, until the compression part supports large folios later. When large folios supported, the iomap routine will allocate iomap_page for each large folio and thus we need iomap_release_folio() and iomap_invalidate_folio() to free iomap_page when these folios get recalimed or invalidated. Signed-off-by: Jingbo Xu Reviewed-by: Chao Yu --- v2: - add calling for iomap_release_folio() and iomap_invalidate_folio() to support large folios v1: https://lore.kernel.org/all/20221110074023.8059-1-jefflexu@linux.alibab= a.com/ --- fs/erofs/data.c | 2 ++ fs/erofs/inode.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/fs/erofs/data.c b/fs/erofs/data.c index fe8ac0e163f7..c9526c627dda 100644 --- a/fs/erofs/data.c +++ b/fs/erofs/data.c @@ -403,6 +403,8 @@ const struct address_space_operations erofs_raw_access_= aops =3D { .readahead =3D erofs_readahead, .bmap =3D erofs_bmap, .direct_IO =3D noop_direct_IO, + .release_folio =3D iomap_release_folio, + .invalidate_folio =3D iomap_invalidate_folio, }; =20 #ifdef CONFIG_FS_DAX diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c index ad2a82f2eb4c..e457b8a59ee7 100644 --- a/fs/erofs/inode.c +++ b/fs/erofs/inode.c @@ -295,6 +295,8 @@ static int erofs_fill_inode(struct inode *inode) goto out_unlock; } inode->i_mapping->a_ops =3D &erofs_raw_access_aops; + if (!erofs_is_fscache_mode(inode->i_sb)) + mapping_set_large_folios(inode->i_mapping); #ifdef CONFIG_EROFS_FS_ONDEMAND if (erofs_is_fscache_mode(inode->i_sb)) inode->i_mapping->a_ops =3D &erofs_fscache_access_aops; --=20 2.19.1.6.gb485710b