diff options
author | Gao Xiang <hsiangkao@redhat.com> | 2021-03-29 03:23:05 +0200 |
---|---|---|
committer | Gao Xiang <hsiangkao@redhat.com> | 2021-03-29 04:24:57 +0200 |
commit | de06a6a375414be03ce5b1054f2d836591923a1d (patch) | |
tree | 8db8685441b4a9a5d712c5679839de2388844077 /fs/erofs/internal.h | |
parent | erofs: add unsupported inode i_format check (diff) | |
download | linux-de06a6a375414be03ce5b1054f2d836591923a1d.tar.xz linux-de06a6a375414be03ce5b1054f2d836591923a1d.zip |
erofs: introduce erofs_sb_has_xxx() helpers
Introduce erofs_sb_has_xxx() to make long checks short, especially
for later big pcluster & LZMA features.
Link: https://lore.kernel.org/r/20210329012308.28743-2-hsiangkao@aol.com
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
Diffstat (limited to 'fs/erofs/internal.h')
-rw-r--r-- | fs/erofs/internal.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index db8c8470269e..a148a039cf67 100644 --- a/fs/erofs/internal.h +++ b/fs/erofs/internal.h @@ -218,6 +218,15 @@ static inline erofs_off_t iloc(struct erofs_sb_info *sbi, erofs_nid_t nid) return blknr_to_addr(sbi->meta_blkaddr) + (nid << sbi->islotbits); } +#define EROFS_FEATURE_FUNCS(name, compat, feature) \ +static inline bool erofs_sb_has_##name(struct erofs_sb_info *sbi) \ +{ \ + return sbi->feature_##compat & EROFS_FEATURE_##feature; \ +} + +EROFS_FEATURE_FUNCS(lz4_0padding, incompat, INCOMPAT_LZ4_0PADDING) +EROFS_FEATURE_FUNCS(sb_chksum, compat, COMPAT_SB_CHKSUM) + /* atomic flag definitions */ #define EROFS_I_EA_INITED_BIT 0 #define EROFS_I_Z_INITED_BIT 1 |