[PATCH 2/2] erofs-utils: lib: fix meta_blkaddr handling for 48-bit layout
Gao Xiang
hsiangkao at linux.alibaba.com
Fri Mar 20 00:45:17 AEDT 2026
On 2026/3/19 21:39, Ajay Rajera wrote:
> Fix the FIXME in metabox.c by properly handling meta_blkaddr for 48-bit layouts. In erofs_writesb(), set meta_blkaddr to 0 on-disk when 48-bit layout is enabled since meta_blkaddr is encoded differently in that mode. Remove the now-resolved FIXME comment in metabox.c as the issue is addressed in super.c.
>
> Signed-off-by: Ajay Rajera <newajay.11r at gmail.com>
> ---
> lib/metabox.c | 1 -
> lib/super.c | 2 +-
> 2 files changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/lib/metabox.c b/lib/metabox.c
> index d6abd51..077f88b 100644
> --- a/lib/metabox.c
> +++ b/lib/metabox.c
> @@ -62,7 +62,6 @@ 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 */
I don't think it's a valid patch, I need to find more clue why
it was a FIXME.
> sbi->meta_blkaddr = EROFS_META_NEW_ADDR;
> }
>
> diff --git a/lib/super.c b/lib/super.c
> index 088c9a0..99d2a24 100644
> --- a/lib/super.c
> +++ b/lib/super.c
> @@ -209,7 +209,7 @@ int erofs_writesb(struct erofs_sb_info *sbi)
> .epoch = cpu_to_le64(sbi->epoch),
> .build_time = cpu_to_le64(sbi->build_time),
> .fixed_nsec = cpu_to_le32(sbi->fixed_nsec),
> - .meta_blkaddr = cpu_to_le32(sbi->meta_blkaddr),
> + .meta_blkaddr = cpu_to_le32(erofs_sb_has_48bit(sbi) ? 0 : sbi->meta_blkaddr),
> .xattr_blkaddr = cpu_to_le32(sbi->xattr_blkaddr),
> .xattr_prefix_count = sbi->xattr_prefix_count,
> .xattr_prefix_start = cpu_to_le32(sbi->xattr_prefix_start),
More information about the Linux-erofs
mailing list