Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1050874pxb; Wed, 6 Apr 2022 07:34:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWDkzViMe/oCgaXrnyYc+Ip3wTLffFSSLHFRh9LHolpuWmpXJYNJeGpdLuYR0B+JctLHAp X-Received: by 2002:a17:902:e547:b0:156:bde6:bd85 with SMTP id n7-20020a170902e54700b00156bde6bd85mr8857167plf.108.1649255667294; Wed, 06 Apr 2022 07:34:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649255667; cv=none; d=google.com; s=arc-20160816; b=C6f5V+a/i4hUt9n8JdrMd5Xg+fA2ZZlfr6Pm6ECuCP9QX+jA1mu6vE49Q8XQ/yuZqD ppgTOPITAsd0QztMfzW2tMfGHwEMvVjMPESSnQ39rzh10n30CUNUtyYT+FkAX0f5Xv6f jKkSsnbYx9dU/jSANVBAmVGSCMSswTlscBi18l/URRZ1/j5eT/i2GSEl6ibNoUsy4e+T B6Jj/Q98zPUzzCIHVuc+fJ137VQUN7s5ZATHlXBmlDHUb2mhfsa90fc72l9cc7clmVml gm98SgJ/WvHCogBxqlNcetkVGmcveaFwTsCsH0MlSfT57gj9OCU1LhCKohfeIbvHvwL/ hJ0g== 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=AzXpojL7TYFblVX4drl4pLhf7g1MUQBCQUG4CEW52DMTZnYEsta3XxCMIB2+ZP4Fqm l983CSyzFzVQbaTGLfBTKE7COXrqgWhgKa9JfSOHCKFltrFa8nXWF8R7b5LmrbDDAXRJ 7t5mrvjQMdHonSUJPxHOhT9Pc9pmJvwzlkyRkgK9uk+byILQprTXqHTIyJZnOisLyJSa iqWzMxKWanHV1HBIoawLYcTHYQ5j+mGcC1HSkysUrvkE/o3GfcybdoBpnjH+FtLEm8jb VTrc2w5uNKKfMgMT8TozMZjWp/WzjaBq/pwo7cAD7ykMr7m4AoSi1oUsSSl4xyqpljuS 6bDA== 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: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id p22-20020a056a000b5600b004fab35f2191si17294847pfo.194.2022.04.06.07.34.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 07:34:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 657CB1820EA; Wed, 6 Apr 2022 05:16:12 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232022AbiDFMPk (ORCPT + 99 others); Wed, 6 Apr 2022 08:15:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231766AbiDFMOI (ORCPT ); Wed, 6 Apr 2022 08:14:08 -0400 Received: from out30-43.freemail.mail.aliyun.com (out30-43.freemail.mail.aliyun.com [115.124.30.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0402425432; Wed, 6 Apr 2022 00:56:32 -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=e01e01424;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=18;SR=0;TI=SMTPD_---0V9L1BLM_1649231786; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0V9L1BLM_1649231786) by smtp.aliyun-inc.com(127.0.0.1); Wed, 06 Apr 2022 15:56:27 +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 v8 09/20] erofs: add mode checking helper Date: Wed, 6 Apr 2022 15:56:01 +0800 Message-Id: <20220406075612.60298-10-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220406075612.60298-1-jefflexu@linux.alibaba.com> References: <20220406075612.60298-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. 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