aboutsummaryrefslogtreecommitdiff
path: root/fs/erofs/internal.h
diff options
context:
space:
mode:
authorGravatar Jeffle Xu <jefflexu@linux.alibaba.com> 2022-04-25 20:21:32 +0800
committerGravatar Gao Xiang <hsiangkao@linux.alibaba.com> 2022-05-18 00:11:19 +0800
commit93b856bb5f66ae149ed91876b17c8c3fca576615 (patch)
tree2167a51c26f000c812514a0e7044c23b4062296c /fs/erofs/internal.h
parenterofs: make erofs_map_blocks() generally available (diff)
downloadlinux-93b856bb5f66ae149ed91876b17c8c3fca576615.tar.gz
linux-93b856bb5f66ae149ed91876b17c8c3fca576615.tar.bz2
linux-93b856bb5f66ae149ed91876b17c8c3fca576615.zip
erofs: add fscache mode check helper
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, and twist the code in preparation for the upcoming fscache mode. Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com> Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com> Link: https://lore.kernel.org/r/20220425122143.56815-11-jefflexu@linux.alibaba.com Acked-by: Chao Yu <chao@kernel.org> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Diffstat (limited to 'fs/erofs/internal.h')
-rw-r--r--fs/erofs/internal.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h
index c83bd3965cb5..52911eaf36f6 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,