[PATCH] erofs-utils: mkfs: fix `--incremental=data` failure

Gao Xiang <[email protected]> Tue, 28 Jul 2026 23:40:32 +0800
Newsgroups org.ozlabs.lists.linux-erofs
Message-ID <[email protected]>
`idata_size` should be set for erofs_prepare_tail_block().

Fixes: c16df072941f ("erofs-utils: mkfs: support directory compression")
Signed-off-by: Gao Xiang <[email protected]>
---
 lib/inode.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/inode.c b/lib/inode.c
index 9f4d14c..0547b60 100644
--- a/lib/inode.c
+++ b/lib/inode.c
@@ -1605,7 +1605,8 @@ static int erofs_mkfs_create_directory(const struct erofs_mkfs_btctx *ctx,
 	}
 
 	/* it will be used in erofs_prepare_inode_buffer */
-	if (inode->datalayout == EROFS_INODE_FLAT_INLINE)
+	if (inode->datalayout == EROFS_INODE_FLAT_INLINE ||
+	    inode->datalayout == EROFS_INODE_FLAT_PLAIN)
 		inode->idata_size = inode->i_size & (bsz - 1);
 
 	/*
-- 
2.47.3