Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp462036pxb; Thu, 31 Mar 2022 09:15:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbWCPhUhvL4HpKJTXx9MiL1F0onnKhMuBmmw6QpOMYdFogvPVPQhtN07HO7xiSLKVH3k64 X-Received: by 2002:a17:90b:3b8f:b0:1c7:b62e:8e87 with SMTP id pc15-20020a17090b3b8f00b001c7b62e8e87mr6959993pjb.156.1648743330768; Thu, 31 Mar 2022 09:15:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648743330; cv=none; d=google.com; s=arc-20160816; b=s388MsLEPxxwnDkP1gJajg5GakgEvJicc+A1ADw27kXT/biuDXI2Q2TTfUn22leLvl NGJn8tn98v9Ju/tSZRi7jJBUYsLbXo0HicYw5FWQP96OTo/u1jYURc9hbUMcEVXe5Ws5 Ea3SNBeb4rygH7uTe0kFCBII52iZuhtJBSDX9vmTEKSTE6yBHhO2iiKZHZWlkfDP5qQQ 40e3A+P8tUBvgygZH4oOQbkrJHW4Vx5ZimRXitw/ERirMOYo6aVW8+LXSTIrpmwjUsR+ 9vMUn0lI/owP7Rjw6OWszGeR89FjuDARnfG+IaRT6iS6Fp+wWayAC97cpS/djHqog1pz v0Kg== 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=4kkjPv4D/k7ri+N8A5qqkrHL3Yf4bjH81iC2bHOGapk=; b=SVfvGIrMvt5HAKzwS1x1CTGil01WFB+sMCP00V3alOvmpqZ2mOnCDV6OCBIZhlYf/E 1vdyN+kHc7oB2xwtP1IirUs2/Vyg/X5jiXlShYgWDUbc/MLwty6MIo60Iy74x6WpUrUw //WSijHI/gC2rKGMa18isGAfQVknY/0tFqDd3FelLDdt4kBx3KF0z75xuqKiw+xvg59y 4WVnaAFA+aCgvrmgVDp38hdZEtPJZd3cxkM1B4yV3c7PJLikWUC7dC2mnIbGU8xxaL7l AoE9vCHvio6352LLtrA1jwkDBEOhtWkuaFKCiDEhW4bWjT2PkuRDPqcmg41nTUEeYmRm X2gA== 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 g14-20020a056a001a0e00b004fa3a8e0015si8155327pfv.204.2022.03.31.09.15.16; Thu, 31 Mar 2022 09:15:30 -0700 (PDT) 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 S235447AbiCaMAg (ORCPT + 99 others); Thu, 31 Mar 2022 08:00:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235419AbiCaMAR (ORCPT ); Thu, 31 Mar 2022 08:00:17 -0400 Received: from out30-44.freemail.mail.aliyun.com (out30-44.freemail.mail.aliyun.com [115.124.30.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFE4C209A45; Thu, 31 Mar 2022 04:58:10 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R991e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04395;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=18;SR=0;TI=SMTPD_---0V8imrrw_1648727885; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0V8imrrw_1648727885) by smtp.aliyun-inc.com(127.0.0.1); Thu, 31 Mar 2022 19:58:06 +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, tianzichen@kuaishou.com, fannaihao@baidu.com Subject: [PATCH v7 08/19] erofs: add mode checking helper Date: Thu, 31 Mar 2022 19:57:42 +0800 Message-Id: <20220331115753.89431-9-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220331115753.89431-1-jefflexu@linux.alibaba.com> References: <20220331115753.89431-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. A new fscache-based mode is going to be introduced for erofs to support scenarios where on-demand read semantics is needed, e.g. container image distribution. In this case, erofs could be mounted from data blobs through fscache. 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 fe9564e5091e..05a97533b1e9 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_is_fscache_mode(struct super_block *sb) +{ + return IS_ENABLED(CONFIG_EROFS_FS_ONDEMAND) && !sb->s_bdev; +} + enum { EROFS_ZIP_CACHE_DISABLED, EROFS_ZIP_CACHE_READAHEAD, -- 2.27.0