Previously, raw inline tails were treated as compressed data, causing
incorrect head padding. Set idata_type according to raw mode.

Fixes: 277a42502a7a ("erofs-utils: mkfs: handle last compacted_2B pack in 
z_erofs_drop_inline_pcluster")
Closes: https://github.com/erofs/erofs-utils/issues/52
Assisted-by: Codex:gpt-5.6-sol
Signed-off-by: Yifan Zhao <[email protected]>
---
 lib/compress.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/compress.c b/lib/compress.c
index f7ad5a1..48a18b9 100644
--- a/lib/compress.c
+++ b/lib/compress.c
@@ -483,7 +483,8 @@ static int z_erofs_fill_inline_data(struct erofs_inode 
*inode, void *data,
 {
        inode->z_advise |= Z_EROFS_ADVISE_INLINE_PCLUSTER;
        inode->idata_size = len;
-       inode->idata_type = EROFS_IDATA_TYPE_COMPRESSED_DEFAULT;
+       inode->idata_type = raw ? EROFS_IDATA_TYPE_RAW :
+                               EROFS_IDATA_TYPE_COMPRESSED_DEFAULT;
 
        inode->idata = malloc(inode->idata_size);
        if (!inode->idata)
@@ -974,7 +975,8 @@ int z_erofs_convert_to_compacted_format(struct erofs_inode 
*inode,
 
        /* generate compacted_2b */
        if (compacted_2b) {
-               if (!compacted_4b_end && inode->idata_size)
+               if (!compacted_4b_end && inode->idata_size &&
+                   inode->idata_type != EROFS_IDATA_TYPE_RAW)
                        inode->idata_type = 
EROFS_IDATA_TYPE_COMPRESSED_END_OF_2B;
                do {
                        in = parse_legacy_indexes(cv, 16, in);
-- 
2.47.3


Reply via email to