[PATCH] blobchunk: fix 48-bit format detection to use final remapped block addresses
Gao Xiang
hsiangkao at linux.alibaba.com
Tue Feb 24 17:44:41 AEDT 2026
Hi puneeth_aditya_5656,
Could you format the commit message instead of leaving
the commit message empty (maximum 72 chars per line).
The subject needs to be fixed as:
erofs-utils: lib: fix 48bit addressing detection for chunk-based format
On 2026/2/24 13:57, puneeth_aditya_5656 wrote:
> ---
> lib/blobchunk.c | 17 +++++++++++++----
> 1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/lib/blobchunk.c b/lib/blobchunk.c
> index a051904..9b8112b 100644
> --- a/lib/blobchunk.c
> +++ b/lib/blobchunk.c
> @@ -154,6 +154,19 @@ int erofs_write_chunk_indexes(struct erofs_inode *inode, struct erofs_vfile *vf,
> unit = EROFS_BLOCK_MAP_ENTRY_SIZE;
>
> chunkblks = 1ULL << (inode->u.chunkformat & EROFS_CHUNK_FORMAT_BLKBITS_MASK);
> +
> + /* check if any chunk lands above 32-bit range once remapped_base is applied */
> + for (src = 0; src < inode->extent_isize / unit * sizeof(void *);
I think it's too late to adjust inode->u.chunkformat,
see erofs_iflush():
I think you currently just add a new function like:
erofs_inode_fixup_chunkformat() {
u64 extent_count = inode->extent_isize / unit;
_48bit = inode->u.chunkformat & EROFS_CHUNK_FORMAT_48BIT;
if (_48bit)
return;
for (src = 0; src < extent_count; ++src) {
if (chunk->blkaddr == EROFS_NULL_ADDR)
continue;
if (chunk->device_id) {
if (chunk->blkaddr > UINT32_MAX) {
_48bit = true;
break;
}
} else if (remapped_base + chunk->blkaddr > UINT32_MAX) {
_48bit = true;
break;
}
}
if (_48bit)
inode->u.chunkformat |= EROFS_CHUNK_FORMAT_48BIT;
}
Also if we really would like to fix this, we need considering add
a testcase for this, possibly use `--offset` to make the image
exceeds 32-bit, see experimental-tests.
Thanks,
Gao Xiang
More information about the Linux-erofs
mailing list