From patchwork Wed Nov 30 06:04:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jingbo Xu X-Patchwork-Id: 27604 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp756869wrr; Tue, 29 Nov 2022 22:31:09 -0800 (PST) X-Google-Smtp-Source: AA0mqf4DoMyWVAEosnfsGghbv5QjYRjPJVbG7XmJLeexdqIqJ+WshB4s59n5zt94Ek/V3Urqcnvg X-Received: by 2002:a17:90a:4812:b0:219:6618:cf46 with SMTP id a18-20020a17090a481200b002196618cf46mr1100749pjh.176.1669789869700; Tue, 29 Nov 2022 22:31:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669789869; cv=none; d=google.com; s=arc-20160816; b=jN2HPa4lhPzMGTLbvOAVXlvrVSRcFAD8YYhs1fpV3g3r+7fZoUFxy1P7mIPXdUOg27 tkal/CmbfZL7UHPRM40mgu4hDxV/6/KuIRFuJDUGxA6q4XYCzc4C1IQSDpZoR4wd7Qn2 IzlMZQSHczb/8QLzPlsEcHsRhPSz+MVt/8tA8ltcXTrqg4FdkY89WIFIhIa0cDcoKEUE VMO2zGNr8XLxLVAwjIkhRDkcfJxeVxNdy/nEff3q5Y7mNEOR9vHAtx8fILFy6oan+LTl 0wS+dcYLLf4ofbePAmXHk+tLPupWYKhUVbT4C3OyCPfx62wjv88/3Gq1J2wm8NrvwnLk XmqA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z6-20020a63b906000000b00477bbd92cfdsi451671pge.592.2022.11.29.22.30.54; Tue, 29 Nov 2022 22:31:09 -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 + 99 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750901582461132051?= X-GMAIL-MSGID: =?utf-8?q?1750901582461132051?= 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.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;