erofs-utils: no compression case for tail-end block in vle_write_indexes()
PATCH v2 1/1 erofs-utils: no compression case for tail-end block in vle_write_indexes()
From: Yue Hu <[email protected]>
Note that count value will be always greater than EROFS_BLKSIZ when calling erofs_compress_destsize() in vle_compress_one(). So, the d1 always >= 1 for compressed block in vle_write_indexes(). That is to say tail-end block can't be compressed.
---
v2: add DBG_BUGON(!raw), a TODO comment.
lib/compress.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
lib/compress.c +4 -3
@@ -73,10 +73,11 @@ static void vle_write_indexes(struct z_erofs_vle_compress_ctx *ctx, di.di_clusterofs =cpu_to_le16 (ctx->clusterofs); -/* whether the tail-end (un)compressed block or not */ +/* whether the tail-end uncompressed block or not */ if (!d1) { - type = raw ?Z_EROFS_VLE_CLUSTER_TYPE_PLAIN : -Z_EROFS_VLE_CLUSTER_TYPE_HEAD ; +/* TODO: tail-packing inline compressed data */ +DBG_BUGON (!raw); + type =Z_EROFS_VLE_CLUSTER_TYPE_PLAIN ; advise =cpu_to_le16 (type <<Z_EROFS_VLE_DI_CLUSTER_TYPE_BIT ); di.di_advise = advise;
Signature · 1 line
1.9.1
Quoted 8 lines · Yue Hu
From: Yue Hu <[email protected]>
Note that count value will be always greater than
EROFS_BLKSIZwhen callingerofs_compress_destsize()invle_compress_one(). So, the d1 always >= 1 for compressed block invle_write_indexes(). That is to say tail-end block can't be compressed.Signed-off-by Yue Hu <[email protected]>
Thanks, looks good to me:
Thanks,
Gao Xiang
Quoted 27 lines
---
v2: addDBG_BUGON(!raw), a TODO comment.lib/compress.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)lib/compress.c +4
-3@@ -73,10 +73,11 @@ static void vle_write_indexes(struct z_erofs_vle_compress_ctx *ctx, di.di_clusterofs =cpu_to_le16 (ctx->clusterofs); -/* whether the tail-end (un)compressed block or not */ +/* whether the tail-end uncompressed block or not */ if (!d1) { - type = raw ?Z_EROFS_VLE_CLUSTER_TYPE_PLAIN : -Z_EROFS_VLE_CLUSTER_TYPE_HEAD ; +/* TODO: tail-packing inline compressed data */ +DBG_BUGON (!raw); + type =Z_EROFS_VLE_CLUSTER_TYPE_PLAIN ; advise =cpu_to_le16 (type <<Z_EROFS_VLE_DI_CLUSTER_TYPE_BIT ); di.di_advise = advise;Signature · 1 line
1.9.1