From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: Zhan Xusheng <zhanxusheng1024@gmail.com>
Cc: linux-erofs@lists.ozlabs.org, Zhan Xusheng <zhanxusheng@xiaomi.com>
Subject: Re: [PATCH erofs-utils v2 2/2] erofs-utils: handle 48-bit blocks/uniaddr for extra devices
Date: Tue, 7 Apr 2026 11:22:34 +0800 [thread overview]
Message-ID: <9e0696c4-95ff-4365-aced-2f67c7f08c85@linux.alibaba.com> (raw)
In-Reply-To: <20260403130546.76579-3-zhanxusheng@xiaomi.com>
On 2026/4/3 21:05, Zhan Xusheng wrote:
> erofs_write_device_table() only writes blocks_lo and uniaddr_lo to
> the on-disk device slot, but does not write blocks_hi or uniaddr_hi.
> Similarly, erofs_init_devices() only reads the _lo fields for extra
> devices.
>
> For extra devices whose blocks or uniaddr exceed 32 bits in a 48-bit
> EROFS image, the upper bits are silently lost in both read and write
> paths. This is inconsistent with the primary device handling, which
> correctly writes blocks_hi (super.c:231) and reads it (super.c:125).
>
> Also sync the erofs_deviceslot on-disk definition with the kernel:
> blocks_hi should be __le16 (not __le32), matching the 48-bit design
> where all block address high parts are 16-bit.
>
> A corresponding kernel fix has been applied:
> ("erofs: handle 48-bit blocks/uniaddr for extra devices")
>
> Signed-off-by: Zhan Xusheng <zhanxusheng@xiaomi.com>
> ---
> include/erofs_fs.h | 4 ++--
> lib/super.c | 10 ++++++++--
> 2 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/include/erofs_fs.h b/include/erofs_fs.h
> index ff8ac78..5d12049 100644
> --- a/include/erofs_fs.h
> +++ b/include/erofs_fs.h
> @@ -45,9 +45,9 @@ struct erofs_deviceslot {
> u8 tag[64]; /* digest(sha256), etc. */
> __le32 blocks_lo; /* total blocks count of this device */
> __le32 uniaddr_lo; /* unified starting block of this device */
> - __le32 blocks_hi; /* total blocks count MSB */
> + __le16 blocks_hi; /* total blocks count MSB */
> __le16 uniaddr_hi; /* unified starting block MSB */
> - u8 reserved[50];
> + u8 reserved[52];
> };
> #define EROFS_DEVT_SLOT_SIZE sizeof(struct erofs_deviceslot)
>
> diff --git a/lib/super.c b/lib/super.c
> index 86d50a1..fd7972c 100644
> --- a/lib/super.c
> +++ b/lib/super.c
> @@ -54,6 +54,8 @@ static int erofs_init_devices(struct erofs_sb_info *sbi,
> if (!sbi->devs)
> return -ENOMEM;
> pos = le16_to_cpu(dsb->devt_slotoff) * EROFS_DEVT_SLOT_SIZE;
> + bool _48bit = erofs_sb_has_48bit(sbi);
It should be refined with the variable definitions.
I will manually fix it up instead.
Thanks,
Gao Xiang
next prev parent reply other threads:[~2026-04-07 3:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <12b129db-0206-44f3-a53c-9eec6fe3fda3@linux.alibaba.com>
2026-04-03 13:05 ` [PATCH erofs-utils v2 0/2] Fix 48-bit block addressing for extra devices Zhan Xusheng
2026-04-03 13:05 ` [PATCH erofs-utils v2 1/2] erofs-utils: fix swapped hi/lo in 48-bit primary blocks read Zhan Xusheng
2026-04-07 7:47 ` Gao Xiang
2026-04-07 8:25 ` Zhan Xusheng
2026-04-03 13:05 ` [PATCH erofs-utils v2 2/2] erofs-utils: handle 48-bit blocks/uniaddr for extra devices Zhan Xusheng
2026-04-07 3:22 ` Gao Xiang [this message]
2026-04-07 3:41 ` Zhan Xusheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9e0696c4-95ff-4365-aced-2f67c7f08c85@linux.alibaba.com \
--to=hsiangkao@linux.alibaba.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=zhanxusheng1024@gmail.com \
--cc=zhanxusheng@xiaomi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox