Before the device_id conversion this error named its target:

        cannot allocate data in the metazone when unavailable for %s

It is now a single device message, and device_id < 0 means the metadata
zone rather than a device, so that case prints the sentinel:

        cannot allocate data on unavailable device -1 for ...

Reachable with mkfs.erofs --incremental --MZ over an image built with
--MZ.  Name the metadata zone again there.

Signed-off-by: Zhan Xusheng <[email protected]>
---
 lib/inode.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/inode.c b/lib/inode.c
index d71a9d1..2cd7bed 100644
--- a/lib/inode.c
+++ b/lib/inode.c
@@ -213,8 +213,12 @@ int erofs_allocate_inode_bh_data(struct erofs_inode 
*inode, erofs_blk_t nblocks,
                bmgr = sbi->devs[device_id - 1].bmgr;
 
        if (!bmgr) {
-               erofs_err("cannot allocate data on unavailable device %d for 
%s",
-                         device_id, inode->i_srcpath);
+               if (device_id < 0)
+                       erofs_err("cannot allocate data in the unavailable 
metadata zone for %s",
+                                 inode->i_srcpath);
+               else
+                       erofs_err("cannot allocate data on unavailable device 
%d for %s",
+                                 device_id, inode->i_srcpath);
                return -EINVAL;
        }
 
-- 
2.43.0


Reply via email to