Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1964304pxb; Fri, 25 Mar 2022 08:44:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJxKl/RjeB+lg0NassVMPJEf8S7e88C9Wd/LXSuPt4czyVoqGpKj0SonC6QfCIJyDAb9CI X-Received: by 2002:a17:907:7f20:b0:6e0:751e:edbb with SMTP id qf32-20020a1709077f2000b006e0751eedbbmr11454333ejc.162.1648223086352; Fri, 25 Mar 2022 08:44:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648223086; cv=none; d=google.com; s=arc-20160816; b=Zo3qKRTL7VctcUnis/gkCPyWPtI/xSPJBClYB45hD9ev7FTkcQSrk72+d5UHQ4O6ZK TYTR2fbnT5qy6Z4jBRysKx0TCJWRMkpJZcLUmNBUh2SGRhfQEt9H88YBk5rZ2aFBnBDb grSNbMgFA2tlUos3LQ/LD6HYl7NIVRU6LjitVK/yP8UMQanGyAXwsiJwk8nO6+EJ3h20 gYaWwJJr5ZmRzm4DhAgga9Nov8xbYfMW+WRNofZoVdyHUnHviaAumYXSC1dpVLMcX2TU Z/tN3y36dTmtP3+iDst7ppiSG4St8zXcehNlCHsXOvkLyifWLotGtglqLgeIe4xUpJty udaA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=hGQeTVUgkpMBvALqnI0Qb9m5jRkelA+aWAOisuPG01c=; b=xpgqP6Df6QKcWKFZgPxWuungQruXr7nDwbU+qiujVC0G3u7g1wcKXaEUa/WxLBARNo x5lVul9ZP49+lRIoMN0A9NB51JfHr/jzW32RFxpwHA5MRU5XFJ1UfG+Kgd2lFJvdUnel Lm3Dm0lhw0DzseKtN04q1bETxK35X+nnlk/wiMukC+gduC5s7783yYRlsq4Nb+elkGg3 DakXI0isUhdgTVgKw/yekw5Wucm4LhIkPMauzfDH+1T7LAumv7PVo9wJCPnCF+2G+bMR 9pmPeDJoKVNTT2Fp3+GJAfdXCLLC+7BbOo0PvROO9mc8bjd7vXWP0A1g7qGmyxFnk3uI yImw== 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 p11-20020a50cd8b000000b00418c2b5be00si2896168edi.226.2022.03.25.08.44.19; Fri, 25 Mar 2022 08:44:45 -0700 (PDT) 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 S1359197AbiCYMZs (ORCPT + 99 others); Fri, 25 Mar 2022 08:25:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354234AbiCYMYm (ORCPT ); Fri, 25 Mar 2022 08:24:42 -0400 Received: from out30-57.freemail.mail.aliyun.com (out30-57.freemail.mail.aliyun.com [115.124.30.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6671D555B; Fri, 25 Mar 2022 05:22:41 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R551e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04395;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=18;SR=0;TI=SMTPD_---0V89qR.F_1648210956; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0V89qR.F_1648210956) by smtp.aliyun-inc.com(127.0.0.1); Fri, 25 Mar 2022 20:22:37 +0800 From: Jeffle Xu To: dhowells@redhat.com, linux-cachefs@redhat.com, xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org Cc: torvalds@linux-foundation.org, gregkh@linuxfoundation.org, willy@infradead.org, linux-fsdevel@vger.kernel.org, joseph.qi@linux.alibaba.com, bo.liu@linux.alibaba.com, tao.peng@linux.alibaba.com, gerry@linux.alibaba.com, eguan@linux.alibaba.com, linux-kernel@vger.kernel.org, luodaowen.backend@bytedance.com, tianzichen@kuaishou.com, fannaihao@baidu.com Subject: [PATCH v6 08/22] erofs: use meta buffers for erofs_read_superblock() Date: Fri, 25 Mar 2022 20:22:09 +0800 Message-Id: <20220325122223.102958-9-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220325122223.102958-1-jefflexu@linux.alibaba.com> References: <20220325122223.102958-1-jefflexu@linux.alibaba.com> 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_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, 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 The only change is that, meta buffers read cache page without __GFP_FS flag, which shall not matter. Signed-off-by: Jeffle Xu Reviewed-by: Chao Yu Reviewed-by: Gao Xiang --- fs/erofs/super.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/fs/erofs/super.c b/fs/erofs/super.c index 915eefe0d7e2..12755217631f 100644 --- a/fs/erofs/super.c +++ b/fs/erofs/super.c @@ -281,21 +281,19 @@ static int erofs_init_devices(struct super_block *sb, static int erofs_read_superblock(struct super_block *sb) { struct erofs_sb_info *sbi; - struct page *page; + struct erofs_buf buf = __EROFS_BUF_INITIALIZER; struct erofs_super_block *dsb; unsigned int blkszbits; void *data; int ret; - page = read_mapping_page(sb->s_bdev->bd_inode->i_mapping, 0, NULL); - if (IS_ERR(page)) { + data = erofs_read_metabuf(&buf, sb, 0, EROFS_KMAP); + if (IS_ERR(data)) { erofs_err(sb, "cannot read erofs superblock"); - return PTR_ERR(page); + return PTR_ERR(data); } sbi = EROFS_SB(sb); - - data = kmap(page); dsb = (struct erofs_super_block *)(data + EROFS_SUPER_OFFSET); ret = -EINVAL; @@ -365,8 +363,7 @@ static int erofs_read_superblock(struct super_block *sb) if (erofs_sb_has_ztailpacking(sbi)) erofs_info(sb, "EXPERIMENTAL compressed inline data feature in use. Use at your own risk!"); out: - kunmap(page); - put_page(page); + erofs_put_metabuf(&buf); return ret; } -- 2.27.0