* [PATCH] erofs-utils: lib: relax erofs_write_device_table() device table check
@ 2026-02-12 0:13 Jonathan Calmels
2026-02-12 9:13 ` Gao Xiang
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Jonathan Calmels @ 2026-02-12 0:13 UTC (permalink / raw)
To: linux-erofs, xiang, jcalmels; +Cc: Gao Xiang, Jonathan Calmels
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.
Signed-off-by: Jonathan Calmels <jcalmels@nvidia.com>
---
lib/super.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/super.c b/lib/super.c
index a203f96..d38396f 100644
--- a/lib/super.c
+++ b/lib/super.c
@@ -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) {
--
2.53.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] erofs-utils: lib: relax erofs_write_device_table() device table check
2026-02-12 0:13 [PATCH] erofs-utils: lib: relax erofs_write_device_table() device table check Jonathan Calmels
@ 2026-02-12 9:13 ` Gao Xiang
2026-02-12 17:00 ` Jonathan Calmels
2026-02-12 18:33 ` [PATCH v2] " Jonathan Calmels
2026-02-13 1:13 ` [PATCH v3] " Jonathan Calmels
2 siblings, 1 reply; 6+ messages in thread
From: Gao Xiang @ 2026-02-12 9:13 UTC (permalink / raw)
To: Jonathan Calmels, linux-erofs, xiang
Hi Jonathan,
On 2026/2/12 08:13, Jonathan Calmels wrote:
> 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.
>
> Signed-off-by: Jonathan Calmels <jcalmels@nvidia.com>
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
> ---
> lib/super.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/super.c b/lib/super.c
> index a203f96..d38396f 100644
> --- a/lib/super.c
> +++ b/lib/super.c
> @@ -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) {
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] erofs-utils: lib: relax erofs_write_device_table() device table check
2026-02-12 9:13 ` Gao Xiang
@ 2026-02-12 17:00 ` Jonathan Calmels
2026-02-12 17:21 ` Gao Xiang
0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Calmels @ 2026-02-12 17:00 UTC (permalink / raw)
To: Gao Xiang; +Cc: linux-erofs, xiang
On Thu, Feb 12, 2026 at 05:13:31PM +0800, Gao Xiang wrote:
> External email: Use caution opening links or attachments
>
>
> Hi Jonathan,
>
> On 2026/2/12 08:13, Jonathan Calmels wrote:
> > 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.
> >
> > Signed-off-by: Jonathan Calmels <jcalmels@nvidia.com>
>
> 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
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
> > ---
> > lib/super.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/super.c b/lib/super.c
> > index a203f96..d38396f 100644
> > --- a/lib/super.c
> > +++ b/lib/super.c
> > @@ -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) {
>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] erofs-utils: lib: relax erofs_write_device_table() device table check
2026-02-12 17:00 ` Jonathan Calmels
@ 2026-02-12 17:21 ` Gao Xiang
0 siblings, 0 replies; 6+ messages in thread
From: Gao Xiang @ 2026-02-12 17:21 UTC (permalink / raw)
To: Jonathan Calmels; +Cc: Gao Xiang, linux-erofs, xiang
On Thu, Feb 12, 2026 at 09:00:18AM -0800, Jonathan Calmels wrote:
> On Thu, Feb 12, 2026 at 05:13:31PM +0800, Gao Xiang wrote:
> > External email: Use caution opening links or attachments
> >
> > Thanks for the patch, could you elaborate how to use this?
...
>
> 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.
>
> > > diff --git a/lib/super.c b/lib/super.c
> > > index a203f96..d38396f 100644
> > > --- a/lib/super.c
> > > +++ b/lib/super.c
> > > @@ -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
> > >
> > > pos = erofs_btell(bh, false);
> > > if (pos == EROFS_NULL_ADDR) {
> >
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] erofs-utils: lib: relax erofs_write_device_table() device table check
2026-02-12 0:13 [PATCH] erofs-utils: lib: relax erofs_write_device_table() device table check Jonathan Calmels
2026-02-12 9:13 ` Gao Xiang
@ 2026-02-12 18:33 ` Jonathan Calmels
2026-02-13 1:13 ` [PATCH v3] " Jonathan Calmels
2 siblings, 0 replies; 6+ messages in thread
From: Jonathan Calmels @ 2026-02-12 18:33 UTC (permalink / raw)
To: linux-erofs; +Cc: Gao Xiang, Jonathan Calmels
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.
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/
Signed-off-by: Jonathan Calmels <jcalmels@nvidia.com>
---
lib/super.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/super.c b/lib/super.c
index a203f96..d38396f 100644
--- a/lib/super.c
+++ b/lib/super.c
@@ -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) {
--
2.53.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH v3] erofs-utils: lib: relax erofs_write_device_table() device table check
2026-02-12 0:13 [PATCH] erofs-utils: lib: relax erofs_write_device_table() device table check Jonathan Calmels
2026-02-12 9:13 ` Gao Xiang
2026-02-12 18:33 ` [PATCH v2] " Jonathan Calmels
@ 2026-02-13 1:13 ` Jonathan Calmels
2 siblings, 0 replies; 6+ messages in thread
From: Jonathan Calmels @ 2026-02-13 1:13 UTC (permalink / raw)
To: linux-erofs; +Cc: Gao Xiang, Jonathan Calmels
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.
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/
Signed-off-by: Jonathan Calmels <jcalmels@nvidia.com>
---
lib/super.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/super.c b/lib/super.c
index a203f96..4a0bb3c 100644
--- a/lib/super.c
+++ b/lib/super.c
@@ -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) {
--
2.53.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-02-13 1:13 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-12 0:13 [PATCH] erofs-utils: lib: relax erofs_write_device_table() device table check Jonathan Calmels
2026-02-12 9:13 ` Gao Xiang
2026-02-12 17:00 ` Jonathan Calmels
2026-02-12 17:21 ` Gao Xiang
2026-02-12 18:33 ` [PATCH v2] " Jonathan Calmels
2026-02-13 1:13 ` [PATCH v3] " Jonathan Calmels
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox