Skip to contentSkip to conversation

erofs-utils: mkfs: fix blobdev with metadata zones

PATCH New Yifan Zhao 1 participant 1 message Sep 5 Library code

lore
Share & tools
lore

Yifan Zhao

author
#0 lore raw

PATCH 1/1 erofs-utils: mkfs: fix blobdev with metadata zones

Using --blobdev with --MZ flushes flat inodes before unified device addresses are assigned, leaving their data addresses unresolved.

Reserve metadata zone space before calculating device addresses, then flush the zone once those addresses are available.

Assisted-by Codex:gpt-6-astra
---
 lib/importer.c         |  7 ++++++-
 lib/liberofs_metabox.h |  1 +
 lib/metabox.c          | 42 ++++++++++++++++++++++++------------------
 3 files changed, 31 insertions(+), 19 deletions(-)
lib/importer.c +6 -1
index 89d4d8b..4506040 100644
@@ -120,7 +120,8 @@ int erofs_importer_flush_all(struct erofs_importer *im)
 	if (err)
 		return err;
 
-	err = erofs_metazone_flush(sbi);
+	/* Include the metadata zone before assigning unified device addresses. */
+	err = erofs_metazone_reserve(sbi);
 	if (err)
 		return err;
 
@@ -132,6 +133,10 @@ int erofs_importer_flush_all(struct erofs_importer *im)
 	if (err)
 		return err;
 
+	err = erofs_metazone_flush(sbi);
+	if (err)
+		return err;
+
 	err = erofs_write_device_table(sbi);
 	if (err)
 		return err;
lib/liberofs_metabox.h +1 -0
index f966c20..156b651 100644
@@ -25,6 +25,7 @@ void erofs_metadata_exit(struct erofs_sb_info *sbi);
 int erofs_metadata_init(struct erofs_sb_info *sbi);
 struct erofs_bufmgr *erofs_metadata_bmgr(struct erofs_sb_info *sbi, bool mbox);
 int erofs_metabox_iflush(struct erofs_importer *im);
+int erofs_metazone_reserve(struct erofs_sb_info *sbi);
 int erofs_metazone_flush(struct erofs_sb_info *sbi);
 
 #endif
lib/metabox.c +24 -18

71 lines not on this page · raw message

Signature · 1 line
2.55.0