Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp969600pxp; Wed, 16 Mar 2022 23:00:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHoctLfvgUi12pxYxVqS89H45MKHkkCoH/ezyNbLqG3DQVi8JJxH2AYlIqwnTFuCpw5cEC X-Received: by 2002:a17:902:7204:b0:153:bffb:f348 with SMTP id ba4-20020a170902720400b00153bffbf348mr2949791plb.147.1647496856321; Wed, 16 Mar 2022 23:00:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647496856; cv=none; d=google.com; s=arc-20160816; b=RlD4j8byLaH7dq2sw0kBXdaknI9CoS30+XiscvUmosLm8rehtdgLP7xhpBHMOQ3mRh 1RCCvxEa9SfFDpYD3T6ghZyP2FkVF4pmay4Y74utxmdRWjkAZbSTZMZzLIKX08sviydW BFW8XOfMCeo32/jIxw4utQ5QESWBKp+jghzizj7dv+6/+TYMWdo9VcficXZpb59I9NY+ tKCNRYyZKoFfPFFKmgxO/ncM8qlv7RHYDf+SuMN8XD7wLW9HPojM/eqzoFWJquYRaXaH 586NNUCKiwgSBFupHpiJTXGZuQCimPl6uTWZMta0ENBdzMKHVgLfwbYmWq3Md0bO14wV hOIQ== 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=RXyjNMFiKuP3YOLb133gHa7NdcpCdwH4/8/b8yegobg=; b=fe8uYBKaN4S49JR613K6jl0W+ghFqo+A4FCDdxcjxwQY1NCgw26L8LVnSSsE12tpXe SunXzXp16VUihUhwYjfQTaK+uJWQ1Ul7ZV4/MII09ZC8qwqnrN61FkpDn40phmPqFHOF 5mD/yAOGW+uIAbMU1hRhFgJ0369kL8Nz6UfDcfGgtPt0kuqCKfIqNo1J2UzWtGHbAP3a zU8ifHjf/g+Gu8WbwWlg3aou3KANrLqDKfeCYxTQwtaqbgwivUxC5YMQZg9jl4rjUdga SXvF837p1VdpUm2AOhX04xkzIAT/REiJDp9giGyLuMIFjSbp0qnEHCmR2Ej8Dh7c9Av5 cmFw== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id k190-20020a636fc7000000b003816043f0ccsi1187941pgc.705.2022.03.16.23.00.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 23:00:56 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2703DBF957; Wed, 16 Mar 2022 22:00:26 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356268AbiCPNTI (ORCPT + 99 others); Wed, 16 Mar 2022 09:19:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356217AbiCPNSz (ORCPT ); Wed, 16 Mar 2022 09:18:55 -0400 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3F2266AEF; Wed, 16 Mar 2022 06:17:39 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R411e4;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=16;SR=0;TI=SMTPD_---0V7Mu9.1_1647436655; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0V7Mu9.1_1647436655) by smtp.aliyun-inc.com(127.0.0.1); Wed, 16 Mar 2022 21:17:36 +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 Subject: [PATCH v5 08/22] erofs: use meta buffers for erofs_read_superblock() Date: Wed, 16 Mar 2022 21:17:09 +0800 Message-Id: <20220316131723.111553-9-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220316131723.111553-1-jefflexu@linux.alibaba.com> References: <20220316131723.111553-1-jefflexu@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no 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 --- 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