[PATCH v2 05/16] erofs-utils: read dis->blocks in erofs_init_devices()
Jingbo Xu
jefflexu at linux.alibaba.com
Wed Aug 2 19:17:39 AEST 2023
Read dis->blocks in erofs_init_devices(). Also fix the missing
le32_to_cpu() when reading mapped_blkaddr.
Initialize sbi->extra_devices from on-disk extra_devices.
Signed-off-by: Jingbo Xu <jefflexu at linux.alibaba.com>
---
lib/super.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/lib/super.c b/lib/super.c
index 16a1d62..1e4f9f4 100644
--- a/lib/super.c
+++ b/lib/super.c
@@ -36,11 +36,7 @@ static int erofs_init_devices(struct erofs_sb_info *sbi,
else
ondisk_extradevs = le16_to_cpu(dsb->extra_devices);
- if (ondisk_extradevs != sbi->extra_devices) {
- erofs_err("extra devices don't match (ondisk %u, given %u)",
- ondisk_extradevs, sbi->extra_devices);
- return -EINVAL;
- }
+ sbi->extra_devices = ondisk_extradevs;
if (!ondisk_extradevs)
return 0;
@@ -59,8 +55,9 @@ static int erofs_init_devices(struct erofs_sb_info *sbi,
return ret;
}
- sbi->devs[i].mapped_blkaddr = dis.mapped_blkaddr;
- sbi->total_blocks += dis.blocks;
+ sbi->devs[i].mapped_blkaddr = le32_to_cpu(dis.mapped_blkaddr);
+ sbi->devs[i].blocks = le32_to_cpu(dis.blocks);
+ sbi->total_blocks += sbi->devs[i].blocks;
pos += EROFS_DEVT_SLOT_SIZE;
}
return 0;
--
2.19.1.6.gb485710b
More information about the Linux-erofs
mailing list