[PATCH] lib/metabox: fix 48-bit layout metablock addressing

oz456 reach.netway at gmail.com
Sat Mar 21 00:59:33 AEDT 2026


Set meta_blkaddr to 0 for 48-bit layouts instead of EROFS_META_NEW_ADDR to properly support large filesystems.
Tested on normal and 48-bit layouts; meta_blkaddr is correct.

Signed-off-by: oz456 <reach.netway at gmail.com>
---
 lib/metabox.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/metabox.c b/lib/metabox.c
index 12706aa..5e55cae 100644
--- a/lib/metabox.c
+++ b/lib/metabox.c
@@ -62,8 +62,10 @@ int erofs_metadata_init(struct erofs_sb_info *sbi)
 		if (ret)
 			goto err_free;
 		sbi->m2gr = m2gr;
-		/* FIXME: sbi->meta_blkaddr should be 0 for 48-bit layouts */
-		sbi->meta_blkaddr = EROFS_META_NEW_ADDR;
+		if (erofs_sb_has_48bit(sbi))
+			sbi->meta_blkaddr = 0;
+		else
+			sbi->meta_blkaddr = EROFS_META_NEW_ADDR;
 	}
 
 	if (!sbi->mxgr && erofs_sb_has_metabox(sbi)) {
-- 
2.34.1



More information about the Linux-erofs mailing list