linux-erofs.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] erofs-utils: mkfs: fill filesystem inode count
@ 2021-09-28  1:44 Gao Xiang
  0 siblings, 0 replies; 2+ messages in thread
From: Gao Xiang @ 2021-09-28  1:44 UTC (permalink / raw)
  To: linux-erofs

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@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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] erofs-utils: mkfs: fill filesystem inode count
@ 2021-09-28  1:41 Gao Xiang
  0 siblings, 0 replies; 2+ messages in thread
From: Gao Xiang @ 2021-09-28  1:41 UTC (permalink / raw)
  To: linux-erofs

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@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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-28  1:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-28  1:44 [PATCH] erofs-utils: mkfs: fill filesystem inode count Gao Xiang
  -- strict thread matches above, loose matches on Subject: below --
2021-09-28  1:41 Gao Xiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).