Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp921413pxp; Wed, 16 Mar 2022 21:23:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcMgFpsRIAxG5FM+lMxEOHQ5YPqAZarnUCAiDXWwXN8E47XJl99OmQyYt5t2hGJ5ttSJFF X-Received: by 2002:a17:902:ec8e:b0:152:939:ac4a with SMTP id x14-20020a170902ec8e00b001520939ac4amr3089348plg.5.1647490984366; Wed, 16 Mar 2022 21:23:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647490984; cv=none; d=google.com; s=arc-20160816; b=ZWFkvgoOJg9smEEq7EcV2+mtzB7bKu54lCp4+1ZV5aa9BFlJetLlG4Ym3RxbJ7TwXj J6YXu2/lvYyMwQ0qoXXzwxhgOwAaxSOheT+D5KyqZj8t4cvqgOvEPExgyiVz9EnA7rWV mBh1e+22wJYICB0hWEQ3HhX2Q0AcS6/5qEq7aAM0+Zov/QQUIN2Pg7QRXteJ53ypfLem SEx0pwwbotWq3B5F12n/KwGIBReRKqwkcobgkR5S5mIvCiuxLtQPLTeDTYyD7Srggqqz B3lT4in+W3Pwl5qv8oNdYS9UZblDZJrAvlc8RFsc7QLfpkej3/CVOQ0XR/ax/K5KDkwz Qsfg== 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=TZg4lsOy48KVNZ0kF7xanvge2tu/6hKRK5V8W3DQdfo=; b=nxSf9Zc9kJix2W2KwE8szEGU1ltkkRYdocAOWwBtyxE03VstJWPO72ON3bvlRY/8eh qczcSFheO+X6u79Ad4exDnD/mRoxo/LidckwNFNAylDud627Hgkv7DD96d4iyT+NXu1W vvvX+opyEtrCnmHbpnWD26/hzK5R1yVCLqu51TzHc5ZzsLU+8FtpH1cnPSsQRwGp+0Gr 7hdFeNC+qpkrKD/eUYjJJa3GLNnpLKM5McMOAyWbCBs3xrg8A1oFJcNO4O30UyziNDY+ hEw6mnaSMYSdh3Hzj7bVYm7lEIwJLoHNeP8osySHW6GO3Iac+negTbhNosBAPuODWJyl 4Qcg== 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 q15-20020a17090a178f00b001c64b4a9bd9si5558722pja.138.2022.03.16.21.23.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 21:23:04 -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 786F0DCE01; Wed, 16 Mar 2022 20:56:16 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356295AbiCPNTb (ORCPT + 99 others); Wed, 16 Mar 2022 09:19:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356232AbiCPNS6 (ORCPT ); Wed, 16 Mar 2022 09:18:58 -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 D8E4C66AEE; Wed, 16 Mar 2022 06:17:43 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04357;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---0V7NEPq3_1647436658; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0V7NEPq3_1647436658) by smtp.aliyun-inc.com(127.0.0.1); Wed, 16 Mar 2022 21:17:39 +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 10/22] erofs: add mode checking helper Date: Wed, 16 Mar 2022 21:17:11 +0800 Message-Id: <20220316131723.111553-11-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 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 e424293f47a2..f66af9ebda43 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