[PATCH v2 04/12] erofs-utils: lib: fix erofs_init_devices() in multidev mode
Jingbo Xu
jefflexu at linux.alibaba.com
Wed Aug 16 12:13:39 AEST 2023
Fix the missing le32_to_cpu(). Read and cache blocks of each device for
later use.
Initialize sbi->extra_devices from on-disk extra_devices.
Fixes: 0ce853a01123 ("erofs-utils: fuse: add multiple device support")
Reviewed-by: Gao Xiang <hsiangkao at linux.alibaba.com>
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 e8e84aa..54ab29b 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