[PATCH] erofs-utils: lib: support >2TiB tarballs for EROFS index-only images

Gao Xiang hsiangkao at linux.alibaba.com
Thu Jan 15 02:52:49 AEDT 2026


Again, the liberofs code for chunked inodes needs to be refactored.

Reported-by: <manageryzy at gmail.com>
Co-developed-by: <manageryzy at gmail.com>
Closes: https://github.com/erofs/erofs-utils/issues/31
Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>
---
 lib/blobchunk.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/blobchunk.c b/lib/blobchunk.c
index c66bd2020e45..f213c2868774 100644
--- a/lib/blobchunk.c
+++ b/lib/blobchunk.c
@@ -499,6 +499,16 @@ int tarerofs_write_chunkes(struct erofs_inode *inode, erofs_off_t data_offset)
 		blkaddr += erofs_blknr(sbi, len);
 		data_offset += len;
 	}
+
+	/*
+	 * XXX: it's safe for now, but we really need to refactor blobchunk
+	 * after 1.9 is out.
+	 */
+	if (blkaddr > UINT32_MAX) {
+		inode->u.chunkformat |= EROFS_CHUNK_FORMAT_48BIT;
+		erofs_info("48-bit block addressin enabled for indexing larger tar");
+		erofs_sb_set_48bit(sbi);
+	}
 	inode->datalayout = EROFS_INODE_CHUNK_BASED;
 	return 0;
 }
-- 
2.43.5



More information about the Linux-erofs mailing list