Skip to contentSkip to conversation

lib/metabox: fix 48-bit layout metablock addressing

PATCH In review oz456 2 participants 2 messages Mar 20 Library code

lore
Share & tools
lore

oz456

author
#0 lore raw

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

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.

---
 lib/metabox.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
lib/metabox.c +4 -2
index 12706aa..5e55cae 100644
@@ -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)) {
Signature · 1 line
2.34.1
#1 lore raw
Quoted 4 lines · On 2026/3/20 21:59, oz456 wrote:

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.

why all you guys change this line?

If you don't run into anything, could you please not touch this if you don't know enough about the codebase?

Quoted 21 lines
---
  lib/metabox.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
lib/metabox.c +4 -2
index 12706aa..5e55cae 100644
@@ -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)) {