Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2032429pxp; Mon, 7 Mar 2022 07:11:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJx/j0cOgWQPMscUBjrbKXuZh+ksRy2y3dC1q0RhqFmCP+SpG37hotYSm5Zwo0LwAbN9k/Iv X-Received: by 2002:aa7:c948:0:b0:413:2bed:e82e with SMTP id h8-20020aa7c948000000b004132bede82emr11713240edt.394.1646665884310; Mon, 07 Mar 2022 07:11:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646665884; cv=none; d=google.com; s=arc-20160816; b=gWOOYZQPtpUSKD/fyMBN45mXDgT5UWAhlbonBv9rTq8DF3VMk+EUHreYWKfNxyrTRq oWL8dluorrC1Np0JrFyh6cTiPWk6z8vz7yxU7jd6DBivplBUHoM45g1IQjbvhun968CY 1BobSTYuX/vKZy/37YseOHOvFfYX/nVOXDSkD/p8VE/Wui4ybnbizzoPiJqRv93plUYT +HJ52F2IQXQ476p6WeoQFZnwXYQmuSV/UUU1qdBqd9klI/bJj5BYvWIJCbZdIosKaOcB IcOWDmGMZq1iMV2zV2WZDQnGhgbRv/g3751bkuetzgyM08HvgoCdeHLD8PsxUxO+6h8o p5uQ== 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=v0l1zbPwow7XEsto3v9XlzwlvkS44y6TY/aEsV4npEuCQ6mpT919jveFE8bdNF1nc1 Gl6nLdhCic0tlR5bcuZ1iytXSnvr4t4WP+IYr0w9osxX6gZbVz6Q7n04du4I4iugxdEh LcYDZ+HyaFxepiS3iWIBdaoSu3q/8UEIY5K/Edxz/9vSDMJNi8NAUh5QeN1jgInMZ36R pGe4GmFurCxIbriUtrgE63NG8BhyE+fYK6kImzxxRsKb+Qv29UUhC+1Cl5DBC71oq5o6 0F/4gqXHPhu8B3+flhrPzUP1zkGe0y2iphkUMYzR8eQYNFLgg1r3px3GVbEvdF6QuuNJ blQw== 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:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa14-20020a170907868e00b006db06ad3a1dsi4329023ejc.572.2022.03.07.07.10.55; Mon, 07 Mar 2022 07:11:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S242387AbiCGMem (ORCPT + 99 others); Mon, 7 Mar 2022 07:34:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242315AbiCGMeQ (ORCPT ); Mon, 7 Mar 2022 07:34:16 -0500 Received: from out30-132.freemail.mail.aliyun.com (out30-132.freemail.mail.aliyun.com [115.124.30.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 939203DDE4; Mon, 7 Mar 2022 04:33:22 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R441e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04394;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=15;SR=0;TI=SMTPD_---0V6VlXwq_1646656398; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0V6VlXwq_1646656398) by smtp.aliyun-inc.com(127.0.0.1); Mon, 07 Mar 2022 20:33: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 v4 09/21] erofs: add mode checking helper Date: Mon, 7 Mar 2022 20:32:53 +0800 Message-Id: <20220307123305.79520-10-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220307123305.79520-1-jefflexu@linux.alibaba.com> References: <20220307123305.79520-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,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,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