Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1789284pxb; Wed, 9 Feb 2022 04:39:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJzDAp0WCMmNcDjlaOk2GuzA5LWeXviVt2MQtPLX7nLv1wVwbKxhIaqqr4JJweOuNLsEHCrN X-Received: by 2002:a63:7e02:: with SMTP id z2mr1785664pgc.162.1644410396441; Wed, 09 Feb 2022 04:39:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644410396; cv=none; d=google.com; s=arc-20160816; b=mkEUeVRpbwqUCpEa3AJQsHfe7idf/Sh88yziFIabKObZ6x94mdBJ17koRAHzgzHD9B 5Pl1JxTSodH8xFAf7X3z5MyrcPIUxJikSoJddlAmEXtGPakJUriCEHdfmoRNOMgVtmn1 DWIhGZfiEJ4M3RCi/gYhldYGdk6sMbYs8JMz6x6SFwMu3LLRG8yuk0bkvWbZvnEt5WTQ naGEg/wEPPyuii7g/OHidDuMZc8MybsOKWLOhqLMcoO6OhAg5bBoqLS28j8KN+W2boAY PUF3HiboxPvZxGBg3wa4yJbvznYT1icspaOgNuTknIfjGswbLLtJ0LZvfXibY4OxBky1 3Erw== 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=RtTayUD162fCDOPot9foCnfss2sI3mOVAiqveW6x8HuGUmYLwZ821DDQz5ZU8t/iLT Chtyi1D8UHcmjjq8dq9VfT3P2gzsp8iH71Wpq6KdaLVurW3+rv5OOUnR/RNeGpXjDbKk 1BDm1Wb+IzhZZ4p+3WapZVeYTsMDmi9JciKOOSlDQpKwgWkDWli5sH2hIZoQdpokw4qR f6kLl3u/JT5ClMfFZgUF/2HJagE1WJX2wSWGr/f6qlKsjBkx0l/zkEWBek94Fu9TUltB L9inSPC55OK9t2jiffUGBw/1DzH5BohWOxHSSu4TTPXt/wP2m3Ngl9GS8FXoPyA/98sU x9hw== 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:18 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. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id i6si4918181pgo.770.2022.02.09.04.39.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 04:39:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 DB1FDE145DBF; Wed, 9 Feb 2022 02:25:22 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235084AbiBIGBa (ORCPT + 99 others); Wed, 9 Feb 2022 01:01:30 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:52006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234784AbiBIGBT (ORCPT ); Wed, 9 Feb 2022 01:01:19 -0500 Received: from out199-17.us.a.mail.aliyun.com (out199-17.us.a.mail.aliyun.com [47.90.199.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35BA9C050CC2; Tue, 8 Feb 2022 22:01:22 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R141e4;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_---0V3zflly_1644386476; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0V3zflly_1644386476) by smtp.aliyun-inc.com(127.0.0.1); Wed, 09 Feb 2022 14:01:17 +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 v3 06/22] erofs: use meta buffers for erofs_read_superblock() Date: Wed, 9 Feb 2022 14:00:52 +0800 Message-Id: <20220209060108.43051-7-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220209060108.43051-1-jefflexu@linux.alibaba.com> References: <20220209060108.43051-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 --- 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