linux-erofs.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Gao Xiang <xiang@kernel.org>
To: linux-erofs@lists.ozlabs.org
Subject: [PATCH] erofs-utils: mkfs: fill filesystem inode count
Date: Tue, 28 Sep 2021 09:44:26 +0800	[thread overview]
Message-ID: <20210928014426.30174-1-xiang@kernel.org> (raw)

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


             reply	other threads:[~2021-09-28  1:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-28  1:44 Gao Xiang [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-09-28  1:41 [PATCH] erofs-utils: mkfs: fill filesystem inode count Gao Xiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210928014426.30174-1-xiang@kernel.org \
    --to=xiang@kernel.org \
    --cc=linux-erofs@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).