Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1695248pxb; Wed, 9 Feb 2022 02:25:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJxhHrrEgHcTegHHnHGIgsOLFrkRDs69tVvZZYt/444fda1ibYhLHoFnPN5wHr5uNL65Q201 X-Received: by 2002:a17:906:f0cb:: with SMTP id dk11mr1299351ejb.20.1644402304401; Wed, 09 Feb 2022 02:25:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644402304; cv=none; d=google.com; s=arc-20160816; b=pYdVxckAGRAkayb4kel981//QTb33+9Iu1+4ueFKjIIL5bSRliBPvwfYETdxwJS/3u lG7RLfC4T+ed9RGPwLYUyCwei6RrNOUKyUQLoKZN4uWR5XWHSCMC0+3VkQipl6GxfOFj 5TNyM1xgcZUAVgiSemHfj5qvmnzGEBPn2BrO8iTowd8VR8vV0tkvnRJnJDfhRES23ueJ HBjicfYgrzSRDo4ZpfKLss5iijnPCcwtZSepmq9ae5nYlJuzc0Oy5e91CNucWtekVS+X II/bnR0RaqAcMV6RRUNZTwMobmEfryV7agChRpf9xHMTs9dNtb32ObhXaSUOV+CjbS6I DtGg== 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=KizzdM83+2I9liiOB+DHUHbhTnAtYR1O6fwT8OqDYRE=; b=eMEkgk7y00joxMSEPYPfVy7QgUqkgr/Sgegt8M+eF6gM2Oz/YLXObMeB8TFTx/TwoY XAZGZYgA0+gwMru4RZUnNROxLXfYIDe0p8gUy7geapBHP0N+CJEE4u9y5B9MmNgPMg5r Z2fVbvN/yoicc5GoO7X91zSI/0yPtmm/Mow34fP0iw3B806MgCe8uw4OSfFf8mh2I/LL 8OO8/1fmwg16/oaW/K0PbHolxbHZFvXBaxP175DrrcCvw5VP7A+Df+0DbOfg0OfewYe0 0QH/q6T7Z+L3drkKUv6Sh2WrMWYx97u+7rGpbQEF++iJ6Zm/ibEWmlDgYz2aKbkf/w3R 5Nhw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o12si5595920ejy.44.2022.02.09.02.24.39; Wed, 09 Feb 2022 02:25:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235318AbiBIGBf (ORCPT + 99 others); Wed, 9 Feb 2022 01:01:35 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:52002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234759AbiBIGBT (ORCPT ); Wed, 9 Feb 2022 01:01:19 -0500 Received: from out30-54.freemail.mail.aliyun.com (out30-54.freemail.mail.aliyun.com [115.124.30.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FAF3C050CC1; Tue, 8 Feb 2022 22:01:22 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R921e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04423;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=15;SR=0;TI=SMTPD_---0V3zaQSC_1644386479; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0V3zaQSC_1644386479) by smtp.aliyun-inc.com(127.0.0.1); Wed, 09 Feb 2022 14:01:19 +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 08/22] erofs: add mode checking helper Date: Wed, 9 Feb 2022 14:00:54 +0800 Message-Id: <20220209060108.43051-9-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=-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 Until then erofs is exactly blockdev based filesystem. In other using scenarios (e.g. container image), erofs needs to run upon files. This patch set is going to introduces a new nodev mode, in which erofs could be mounted from a bootstrap blob file containing complete erofs image. Add a helper checking which mode erofs works in. Signed-off-by: Jeffle Xu --- fs/erofs/internal.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index f9f94d63d40f..2b9337d385ce 100644 --- a/fs/erofs/internal.h +++ b/fs/erofs/internal.h @@ -161,6 +161,11 @@ struct erofs_sb_info { #define set_opt(opt, option) ((opt)->mount_opt |= EROFS_MOUNT_##option) #define test_opt(opt, option) ((opt)->mount_opt & EROFS_MOUNT_##option) +static inline bool erofs_bdev_mode(struct super_block *sb) +{ + return sb->s_bdev; +} + enum { EROFS_ZIP_CACHE_DISABLED, EROFS_ZIP_CACHE_READAHEAD, -- 2.27.0