[PATCH] erofs-utils: mkfs: fill filesystem inode count

Gao Xiang xiang at kernel.org
Tue Sep 28 11:44:26 AEST 2021


Inode count was missing to fill when refactoring. Fix it.

Fixes: a17497f0844a ("erofs-utils: introduce inode operations")
Fixes: 5e35b75ad499 ("erofs-utils: introduce fuse implementation")
Signed-off-by: Gao Xiang <xiang at kernel.org>
---
 lib/inode.c | 3 +--
 mkfs/main.c | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/inode.c b/lib/inode.c
index 26ffa4b2bb38..1538673aa0c6 100644
--- a/lib/inode.c
+++ b/lib/inode.c
@@ -855,14 +855,13 @@ static int erofs_fill_inode(struct erofs_inode *inode,
 
 static struct erofs_inode *erofs_new_inode(void)
 {
-	static unsigned int counter;
 	struct erofs_inode *inode;
 
 	inode = calloc(1, sizeof(struct erofs_inode));
 	if (!inode)
 		return ERR_PTR(-ENOMEM);
 
-	inode->i_ino[0] = counter++;	/* inode serial number */
+	inode->i_ino[0] = sbi.inos++;	/* inode serial number */
 	inode->i_count = 1;
 
 	init_list_head(&inode->i_subdirs);
diff --git a/mkfs/main.c b/mkfs/main.c
index beba6eb8b905..1c8dea55f0cd 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -387,7 +387,7 @@ int erofs_mkfs_update_super_block(struct erofs_buffer_head *bh,
 	struct erofs_super_block sb = {
 		.magic     = cpu_to_le32(EROFS_SUPER_MAGIC_V1),
 		.blkszbits = LOG_BLOCK_SIZE,
-		.inos   = 0,
+		.inos   = cpu_to_le64(sbi.inos),
 		.build_time = cpu_to_le64(sbi.build_time),
 		.build_time_nsec = cpu_to_le32(sbi.build_time_nsec),
 		.blocks = 0,
-- 
2.20.1



More information about the Linux-erofs mailing list