Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2413196pxp; Mon, 7 Mar 2022 15:03:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJxUHbBcNa303e//hMSQ21ngNsq6IX/z+UJsXWYsyN/2Xj8gwBKUVFAdnsdgi8xrCAKVB9sn X-Received: by 2002:a17:906:314b:b0:6d6:da31:e545 with SMTP id e11-20020a170906314b00b006d6da31e545mr11240808eje.125.1646694228183; Mon, 07 Mar 2022 15:03:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646694228; cv=none; d=google.com; s=arc-20160816; b=JPuP5ihCgw3CSqip19aQFTnfCFUOphlxphzxXnGiQyVPl8ZB/gmWLTQQ/VSILH6Pv6 VryF528h3g/V6ytwi5dvB+c+knB8ov2BUBXs3wEfClAWBADaCrCkkbLsdiAG/2Fh75mj CxkzL1QCw3NtxDywYQN1sz2dYp5D+8nqQLynTrpJLlaeZuINGPAtZbggdXbk9lurMl8s vcu81R6Z06BZrR6nDehuQWLMjYf0VKjhjBaMeXYBH+Nd+BiXHR5WmAjT7WOXCaEARTTb pFUYXcIvVsq32sTm/ZVLd2wSaKp9f7vEdd/+SvqGNY7SOplNeq35/mFA6sQ8CBwCMfFF e8dg== 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=6t/66DyqhRU/ByYi2nQG6VQc31dfUWM6c5FKExLuNgg=; b=YjhxIdQYzN+JhOw4ZL4Ia5OUbQoQwFNb1R5fci3R5Aq9s9k5qBvWAyRxIRRUYt8Smm 3uyAK2NMdHbDFFmg64YbZAotq0beR9TjJoQT4bIlOye9m55g4y/OoeG3oGnHANbyYpyb p5SnZlRkwxpP7JBiYZuKp10seEuQgJshDEbfRK8SxqYBA2J2x6BAIW+Obi47JmgkQiq6 JwMjiwjwGXSTPBXEpNCCNg96Bk1bt9F+qipQyimt088+Ix6Fl40Wn/snVryQ0SKy33ie N7kqv4Pfu2MfXgvQbljyp5CGnLrPC1VZRJjUuc/fgOs5kPgWqHCsPI5j8SV40BXVUHVG vhkA== 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 x25-20020a170906b09900b006d0e259d306si8735084ejy.913.2022.03.07.15.03.24; Mon, 07 Mar 2022 15:03:48 -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 S236559AbiCGMeb (ORCPT + 99 others); Mon, 7 Mar 2022 07:34:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242333AbiCGMeO (ORCPT ); Mon, 7 Mar 2022 07:34:14 -0500 Received: from out30-44.freemail.mail.aliyun.com (out30-44.freemail.mail.aliyun.com [115.124.30.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C35BD3BBD4; Mon, 7 Mar 2022 04:33:19 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R761e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04400;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=15;SR=0;TI=SMTPD_---0V6WEimV_1646656396; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0V6WEimV_1646656396) by smtp.aliyun-inc.com(127.0.0.1); Mon, 07 Mar 2022 20:33:16 +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 Subject: [PATCH v4 07/21] erofs: use meta buffers for erofs_read_superblock() Date: Mon, 7 Mar 2022 20:32:51 +0800 Message-Id: <20220307123305.79520-8-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220307123305.79520-1-jefflexu@linux.alibaba.com> References: <20220307123305.79520-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,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 --- 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