diff options
author | Gao Xiang <gaoxiang25@huawei.com> | 2019-12-31 16:22:00 +0800 |
---|---|---|
committer | Gao Xiang <gaoxiang25@huawei.com> | 2020-01-02 23:18:44 +0800 |
commit | 622be103825c406226c7aa38e76b7b02268075f9 (patch) | |
tree | a236add627d381884bda130b0cb60647a5c4fe05 /lib/compress.c | |
parent | 2d34da865a52c6d3c16668d11c009e84e4e2191b (diff) |
erofs-utils: wrap up sb feature operations
Add some helpers for shorter lines. No logic change.
Link: https://lore.kernel.org/r/20191231082200.152744-1-gaoxiang25@huawei.com
Reviewed-by: Li Guifu <blucer.lee@foxmail.com>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Diffstat (limited to 'lib/compress.c')
-rw-r--r-- | lib/compress.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/compress.c b/lib/compress.c index 99fd527..8337487 100644 --- a/lib/compress.c +++ b/lib/compress.c @@ -120,13 +120,12 @@ static int write_uncompressed_block(struct z_erofs_vle_compress_ctx *ctx, int ret; unsigned int count; - if (!(sbi.feature_incompat & EROFS_FEATURE_INCOMPAT_LZ4_0PADDING)) { - /* fix up clusterofs to 0 if possable */ - if (ctx->head >= ctx->clusterofs) { - ctx->head -= ctx->clusterofs; - *len += ctx->clusterofs; - ctx->clusterofs = 0; - } + /* reset clusterofs to 0 if permitted */ + if (!erofs_sb_has_lz4_0padding() && + ctx->head >= ctx->clusterofs) { + ctx->head -= ctx->clusterofs; + *len += ctx->clusterofs; + ctx->clusterofs = 0; } /* write uncompressed data */ @@ -184,8 +183,7 @@ nocompression: erofs_dbg("Writing %u compressed data to block %u", count, ctx->blkaddr); - if (sbi.feature_incompat & - EROFS_FEATURE_INCOMPAT_LZ4_0PADDING) + if (erofs_sb_has_lz4_0padding()) ret = blk_write(dst - (EROFS_BLKSIZ - ret), ctx->blkaddr, 1); else @@ -514,7 +512,7 @@ int z_erofs_compress_init(void) */ if (!cfg.c_compr_alg_master || strncmp(cfg.c_compr_alg_master, "lz4", 3)) - sbi.feature_incompat &= ~EROFS_FEATURE_INCOMPAT_LZ4_0PADDING; + erofs_sb_clear_lz4_0padding(); if (!cfg.c_compr_alg_master) return 0; |