Skip to contentSkip to conversation

erofs-utils: dump: fix --path after converting erofs_get_pathname()

PATCH New Gao Xiang 1 participant 3 messages Dec 23, 2021 Library code

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/2 erofs-utils: dump: fix --path after converting erofs_get_pathname()

Otherwise it reports:

 $ dump.erofs --path=/ foo.erofs.img
 <E> erofs: file path not found @ nid 36
Fixes e6082718f743 ("erofs-utils: lib: add API to get pathname of EROFS inode")
---
 dump/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
dump/main.c +1 -1
index 9d05d89..0616113 100644
@@ -345,7 +345,7 @@ static void erofsdump_show_fileinfo(bool show_extent)
 		return;
 	}
 
-	err = erofs_get_pathname(dumpcfg.nid, path, sizeof(path));
+	err = erofs_get_pathname(inode.nid, path, sizeof(path));
 	if (err < 0) {
 		erofs_err("file path not found @ nid %llu", inode.nid | 0ULL);
 		return;
Signature · 1 line
2.24.4
author
#1 lore raw

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

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")
---
 lib/blobchunk.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
lib/blobchunk.c +3 -1
index 5e9a88a..2e06b0c 100644
@@ -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);
Signature · 1 line
2.24.4
author
#2 lore raw

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

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")
---
 lib/blobchunk.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
lib/blobchunk.c +3 -1
index 5e9a88a..2e06b0c 100644
@@ -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);
Signature · 1 line
2.24.4