aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGao Xiang <hsiangkao@linux.alibaba.com>2023-03-01 02:54:58 +0800
committerGao Xiang <hsiangkao@linux.alibaba.com>2023-03-01 23:03:06 +0800
commitef74e215647e0d602d5e24039acbcfb18e55e516 (patch)
tree0137cb41eb9dde64de0df9570653b6de50904437
parent8fc95ab3dcea41bc0cdfa5f9b813e6ca0e76d664 (diff)
downloaderofs-utils-ef74e215647e0d602d5e24039acbcfb18e55e516.tar.gz
erofs-utils: use compressed pclusters to mark fragments
The decoded lengths of uncompressed pclusters should be strictly no more than encoded lengths. Fixes: 9fa9b017f773 ("erofs-utils: mkfs: support fragments") Reviewed-by: Yue Hu <huyue2@coolpad.com> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com> Link: https://lore.kernel.org/r/20230228185459.117762-2-hsiangkao@linux.alibaba.com
-rw-r--r--lib/compress.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/compress.c b/lib/compress.c
index 0aaec30..8169990 100644
--- a/lib/compress.c
+++ b/lib/compress.c
@@ -95,7 +95,7 @@ static void z_erofs_write_indexes(struct z_erofs_vle_compress_ctx *ctx)
* A lcluster cannot have three parts with the middle one which
* is well-compressed for !ztailpacking cases.
*/
- DBG_BUGON(!ctx->e.raw && !cfg.c_ztailpacking);
+ DBG_BUGON(!ctx->e.raw && !cfg.c_ztailpacking && !cfg.c_fragments);
DBG_BUGON(ctx->e.partial);
type = ctx->e.raw ? Z_EROFS_VLE_CLUSTER_TYPE_PLAIN :
Z_EROFS_VLE_CLUSTER_TYPE_HEAD;
@@ -457,7 +457,7 @@ frag_packing:
if (ret < 0)
return ret;
ctx->e.compressedblks = 0; /* indicate a fragment */
- ctx->e.raw = true;
+ ctx->e.raw = false;
ctx->fragemitted = true;
fix_dedupedfrag = false;
/* tailpcluster should be less than 1 block */
@@ -928,7 +928,7 @@ int erofs_write_compressed_file(struct erofs_inode *inode, int fd)
z_erofs_write_indexes(&ctx);
ctx.e.length = inode->fragment_size;
ctx.e.compressedblks = 0;
- ctx.e.raw = true;
+ ctx.e.raw = false;
ctx.e.partial = false;
ctx.e.blkaddr = ctx.blkaddr;
}