Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5689100pxb; Thu, 20 Jan 2022 02:31:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJwZA7f/ADVtXD6IYSmGihggTWQIZ7VAgqArMLFGpaNZAMZyUUPTPKDnSj+mksC+hg7gZJAw X-Received: by 2002:a17:90a:2ec4:: with SMTP id h4mr9978575pjs.173.1642674694408; Thu, 20 Jan 2022 02:31:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642674694; cv=none; d=google.com; s=arc-20160816; b=HWYzRg3KlYk8lGSSUV7EsfcLGEnbkX6aNoPcSW85pztnY7qACvEBvBewDnUQNXmzFO Nf+LDTR7FavcexKOEnz3JmyTuhVwF+pwvyhYgvuzPzlFamVklqGq+tjil3jcfr2oqhde ocpqyAdvXp+TnyWh1zhTsXj5ICXjoObM6G52EPiHkIfuCCCimUDoUFqLukQ6/AdIeOnM oMDK07oguei0s/OHv0EIHDHAYhr8+DHC6CPhPwoM2S4vZcvPYRr8Bu0JSHwm/m1wMSmj Zf149GLsDgazA3McDY9aystutBndHeAVoFW8p9SmN+z+4aQNVu/UrACA2JWud2EtWiro cMoQ== 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=xncbgdtkpapCpSXX4Tx47ikQSx4C7GnDhBYzT4H5xuzrw1LUcIkm7vYQQayblhxctm FhL8pS4ssfAgGFP416N36U6HpBV8brlePlK700zzeNN2fA27c2LPDYS2gj2pH+scTaIe nPp3FrUCvJd4v8di7DUFRlKKlVzS8fXS2dby+YBsXOaTAhIrax78SYevxKrkGssRCTv/ 9bMseJwUy0EnxxPgtYez/ZTmxjbE/b+yd95T/cv0NktIwtdKl8pYXkqZHTg2ZjHYTtD0 RbEfoQtq/wIxG2U+CJDgomMwb2n5rYVUR6vMMkHdB8/CAMytfs8YvVi2CR3gPCpD3sAe FLGA== 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 ch22si8964803pjb.169.2022.01.20.02.31.22; Thu, 20 Jan 2022 02:31:34 -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 S242842AbiARNN3 (ORCPT + 99 others); Tue, 18 Jan 2022 08:13:29 -0500 Received: from out30-44.freemail.mail.aliyun.com ([115.124.30.44]:34029 "EHLO out30-44.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242134AbiARNMa (ORCPT ); Tue, 18 Jan 2022 08:12:30 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R321e4;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=12;SR=0;TI=SMTPD_---0V2C5Co8_1642511547; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0V2C5Co8_1642511547) by smtp.aliyun-inc.com(127.0.0.1); Tue, 18 Jan 2022 21:12:28 +0800 From: Jeffle Xu To: dhowells@redhat.com, linux-cachefs@redhat.com, xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org Cc: 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 v2 09/20] erofs: add mode checking helper Date: Tue, 18 Jan 2022 21:12:05 +0800 Message-Id: <20220118131216.85338-10-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220118131216.85338-1-jefflexu@linux.alibaba.com> References: <20220118131216.85338-1-jefflexu@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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