Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1916306rwb; Tue, 29 Nov 2022 22:49:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf5mk6rRWi8vBFnCRe31ij4InzonE+9bwYpQJa2068c9IDl562P01g6b4destcThlmgGdCnC X-Received: by 2002:a05:6402:5413:b0:458:211d:cbe4 with SMTP id ev19-20020a056402541300b00458211dcbe4mr5809393edb.11.1669790962319; Tue, 29 Nov 2022 22:49:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669790962; cv=none; d=google.com; s=arc-20160816; b=zsJQ1k9r7mQk97rVq3glNRksEFgUTkRgzggM7mCZsE8vjYzrmmCsSXqry38QyC9uff kONAdkJ3roYo/+rQO8ZoJSPbhRlfzZGdHVYJQP1Vo+6JCk/Fq2TqeXVzngMTtWxkGlA8 vToLL7yKq9wldlf2ITF3gBSPqzb5IhAOuwTEoOJqarmee2xVYM46onORZIy7C73brRq+ 5kqGIhDEooh/KYXwTsBISFOKRWXtMyPAoHPD0xB6qKJhhTYB5tGQN2kjskWaT71nBnuA Uh3d+HwboQW1HZ17JGAJvFN7BStuKXs6UmGEc8hQt+ajqwJEl9AOaYwpX0Q3pYq9C/YC GtWQ== 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; bh=pd+yNnPwNRByrIkpzHFUG7V8i9H/dWImddjqL9Nv690=; b=IwkgEvnZdQEyTNLroCjPNrRapGUPC8WiyaxX2hZ2F6tgQ/GwDF6kDCkijGlGZpgga4 a7ws2BWi18RCDFIzujY9n1ea3lShas+D6avqP3uu3GyZ4D9gbDNYfml0W+JxQynnTPWd J1gT8GfRe0pAxC5USNUwnFvZlCM0qL3HYDZGMQWqEIizclPBSeWPri5PMDW6xUvmWKQ0 0LyaCwlVyUkiDan7ycAgx94JMnkpSWZfyPI5w6upNtO26ZYzY9i8uzl+CuX0GJywFPCI JMhtMm6kjOeoQzFC97NJUcebzrCN6JkrDwLJXcN7kTDm7CrctpQ0g+X0GE0aV+7HUGwu Y7HA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hp8-20020a1709073e0800b0078d027ceb41si682726ejc.857.2022.11.29.22.49.01; Tue, 29 Nov 2022 22:49:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233888AbiK3GFB (ORCPT + 86 others); Wed, 30 Nov 2022 01:05:01 -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: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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.alibaba.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 = { .readahead = erofs_readahead, .bmap = erofs_bmap, .direct_IO = noop_direct_IO, + .release_folio = iomap_release_folio, + .invalidate_folio = iomap_invalidate_folio, }; #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 = &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 = &erofs_fscache_access_aops; -- 2.19.1.6.gb485710b