erofs-utils: lib: relax erofs_write_device_table() device table check
PATCH 1/1 erofs-utils: lib: relax erofs_write_device_table() device table check
Avoid returning an error in erofs_write_device_table() if a new device slot table hasn't been allocated. Rationale is to allow erofs_importer_flush_all() to succeed when dealing with images with pre-existing device slots.
--- lib/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/super.c +1 -1
@@ -392,7 +392,7 @@ int erofs_write_device_table(struct erofs_sb_info *sbi)if (!sbi->extra_devices) goto out;if (!bh) -return -EINVAL ; + goto out; pos =erofs_btell (bh, false);if (pos ==EROFS_NULL_ADDR ) {
Signature · 1 line
2.53.0
Hi Jonathan,
Quoted 6 lines · Jonathan Calmels
Avoid returning an error in
erofs_write_device_table()if a new device slot table hasn't been allocated. Rationale is to allowerofs_importer_flush_all()to succeed when dealing with images with pre-existing device slots.Signed-off-by Jonathan Calmels <[email protected]>
Thanks for the patch, could you elaborate how to use this?
A detailed command line usage would be better.
(Also honestly I will try to release erofs-utils 1.9 in
a few days for the upcoming ubuntu LTS, so I have to finish erofs fsmerge feature for compression layout after the version is released...)
Thanks,
Gao Xiang
Quoted 17 lines
--- lib/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/super.c +1
-1@@ -392,7 +392,7 @@ int erofs_write_device_table(struct erofs_sb_info *sbi)if (!sbi->extra_devices) goto out;if (!bh) -return -EINVAL ; + goto out; pos =erofs_btell (bh, false);if (pos ==EROFS_NULL_ADDR ) {
Quoted 17 lines · Gao Xiang
External email: Use caution opening links or attachments
Hi Jonathan,
Quoted 6 lines · Jonathan Calmels
Avoid returning an error in
erofs_write_device_table()if a new device slot table hasn't been allocated. Rationale is to allowerofs_importer_flush_all()to succeed when dealing with images with pre-existing device slots.Signed-off-by Jonathan Calmels <[email protected]>Thanks for the patch, could you elaborate how to use this?
A detailed command line usage would be better.
Quoted 7 lines
(Also honestly I will try to release erofs-utils 1.9 in
a few days for the upcoming ubuntu LTS, so I have to finish erofs fsmerge feature for compression layout after the version is released...)Thanks,
Gao Xiang
I'm relying on the library not the CLI, I think the equivalent would be:
mkfs.erofs -Efragments,noinline_data,ztailpacking a.erofs a/ mkfs.erofs -Efragments,noinline_data,ztailpacking b.erofs b/ mkfs.erofs merged.erofs a.erofs b.erofs
mkfs.erofs --incremental=data merged.erofs c/
It does seem to work as expected after the patch, but let me know if I missed anything.
Thanks
Quoted 18 lines
Quoted 17 lines
--- lib/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/super.c +1
-1@@ -392,7 +392,7 @@ int erofs_write_device_table(struct erofs_sb_info *sbi)if (!sbi->extra_devices) goto out;if (!bh) -return -EINVAL ; + goto out; pos =erofs_btell (bh, false);if (pos ==EROFS_NULL_ADDR ) {
Quoted 4 lines · Jonathan Calmels
Quoted 3 lines · Gao Xiang
External email: Use caution opening links or attachments
Thanks for the patch, could you elaborate how to use this?
...
Quoted 7 lines
I'm relying on the library not the CLI, I think the equivalent would be:
mkfs.erofs -Efragments,noinline_data,ztailpacking a.erofs a/ mkfs.erofs -Efragments,noinline_data,ztailpacking b.erofs b/ mkfs.erofs merged.erofs a.erofs b.erofs
mkfs.erofs --incremental=data merged.erofs c/
Could you document this in the commit message?
I think it makes sense, also lacks of -z
if -Efragments is specified.
Quoted 11 lines
Quoted 11 lines
lib/super.c int erofs_write_device_table(struct erofs_sb_info *sbi) · line 395
Quoted 11 lines
lib/super.c +1
-1@@ -392,7 +392,7 @@ int erofs_write_device_table(struct erofs_sb_info *sbi)if (!sbi->extra_devices) goto out;if (!bh) -return -EINVAL ; + goto out;
How about updating to the following instead for now?
if (!sbi->extra_devices)
goto out;
- if (!bh)
+ if (!bh) {
+ if (erofs_sb_has_device_table(sbi))
+ return 0;
return -EINVAL;+ }
pos = erofs_btell(bh, false);
if (pos == NULL_ADDR_UL) {Thanks,
Gao Xiang
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
lib/super.c +0
-0pos =erofs_btell (bh, false);if (pos ==EROFS_NULL_ADDR ) {
PATCH v2 1/1 erofs-utils: lib: relax erofs_write_device_table() device table check
In reply to Jonathan CalmelsAvoid returning an error in erofs_write_device_table() if a new device slot table hasn't been allocated. Rationale is to allow erofs_importer_flush_all() to succeed when dealing with images with pre-existing device slots.
This effectively allows the following:
mkfs.erofs -Enoinline_data a.erofs a/
mkfs.erofs -Enoinline_data b.erofs b/
mkfs.erofs merged.erofs a.erofs b.erofs
mkfs.erofs --incremental=data merged.erofs c/
--- lib/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/super.c +1 -1
@@ -392,7 +392,7 @@ int erofs_write_device_table(struct erofs_sb_info *sbi)if (!sbi->extra_devices) goto out;if (!bh) -return -EINVAL ; + goto out; pos =erofs_btell (bh, false);if (pos ==EROFS_NULL_ADDR ) {
Signature · 1 line
2.53.0
PATCH v3 1/1 erofs-utils: lib: relax erofs_write_device_table() device table check
In reply to Jonathan CalmelsAvoid returning an error in erofs_write_device_table() if a new device slot table hasn't been allocated. Rationale is to allow erofs_importer_flush_all() to succeed when dealing with images with pre-existing device slots.
This effectively allows the following:
mkfs.erofs -Enoinline_data a.erofs a/
mkfs.erofs -Enoinline_data b.erofs b/
mkfs.erofs merged.erofs a.erofs b.erofs
mkfs.erofs --incremental=data merged.erofs c/
--- lib/super.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
lib/super.c +4 -1
@@ -391,8 +391,11 @@ int erofs_write_device_table(struct erofs_sb_info *sbi)if (!sbi->extra_devices) goto out; -if (!bh) +if (!bh) { +if (erofs_sb_has_device_table (sbi)) +return 0 ;return -EINVAL ; + } pos =erofs_btell (bh, false);if (pos ==EROFS_NULL_ADDR ) {
Signature · 1 line
2.53.0