[PATCH v2 2/2] erofs-utils: lib: fix --blobdev without -Eforce-chunk-indexes

Gao Xiang hsiangkao at linux.alibaba.com
Thu Dec 23 19:49:07 AEDT 2021


blockmap is used by default, chunk indexes should be switched
instead if --blobdev is specified.

Fixes: 016bd812be1e ("erofs-utils: mkfs: enable block map chunk format")
Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>
---
 lib/blobchunk.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/blobchunk.c b/lib/blobchunk.c
index 5e9a88a..2e06b0c 100644
--- a/lib/blobchunk.c
+++ b/lib/blobchunk.c
@@ -113,7 +113,7 @@ int erofs_blob_write_chunk_indexes(struct erofs_inode *inode,
 
 	if (multidev) {
 		idx.device_id = 1;
-		inode->u.chunkformat |= EROFS_CHUNK_FORMAT_INDEXES;
+		DBG_BUGON(!(inode->u.chunkformat & EROFS_CHUNK_FORMAT_INDEXES));
 	} else {
 		base_blkaddr = remapped_base;
 	}
@@ -171,6 +171,8 @@ int erofs_blob_write_chunked_file(struct erofs_inode *inode)
 	int fd, ret;
 
 	inode->u.chunkformat |= inode->u.chunkbits - LOG_BLOCK_SIZE;
+	if (multidev)
+		inode->u.chunkformat |= EROFS_CHUNK_FORMAT_INDEXES;
 
 	if (inode->u.chunkformat & EROFS_CHUNK_FORMAT_INDEXES)
 		unit = sizeof(struct erofs_inode_chunk_index);
-- 
2.24.4



More information about the Linux-erofs mailing list