diff mbox series

[f2fs-dev,2/4] mkfs.f2fs: remove unneeded nat initialization in f2fs_update_nat_root()

Message ID 20230517082632.748914-2-chao@kernel.org (mailing list archive)
State New
Headers show
Series [f2fs-dev,1/4] f2fs-tools: add noatime for quota file | expand

Commit Message

Chao Yu May 17, 2023, 8:26 a.m. UTC
- remove unneeded nat initialization for root/quota inode due to
it has been initialized in nat journal.
- name f2fs_update_nat_root() to f2fs_update_nat_default().

Signed-off-by: Chao Yu <chao@kernel.org>
---
 mkfs/f2fs_format.c | 24 ++----------------------
 1 file changed, 2 insertions(+), 22 deletions(-)
diff mbox series

Patch

diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
index df6bde2..620f779 100644
--- a/mkfs/f2fs_format.c
+++ b/mkfs/f2fs_format.c
@@ -1413,12 +1413,10 @@  static int f2fs_write_qf_inode(int qtype, int offset)
 	return 0;
 }
 
-static int f2fs_update_nat_root(void)
+static int f2fs_update_nat_default(void)
 {
 	struct f2fs_nat_block *nat_blk = NULL;
 	uint64_t nat_seg_blk_offset = 0;
-	enum quota_type qtype;
-	int i;
 
 	nat_blk = calloc(F2FS_BLKSIZE, 1);
 	if(nat_blk == NULL) {
@@ -1426,24 +1424,6 @@  static int f2fs_update_nat_root(void)
 		return -1;
 	}
 
-	/* update quota */
-	for (qtype = i = 0; qtype < F2FS_MAX_QUOTAS; qtype++) {
-		if (!((1 << qtype) & c.quota_bits))
-			continue;
-		nat_blk->entries[sb->qf_ino[qtype]].block_addr =
-				cpu_to_le32(get_sb(main_blkaddr) +
-				c.cur_seg[CURSEG_HOT_NODE] *
-				c.blks_per_seg + i + 1);
-		nat_blk->entries[sb->qf_ino[qtype]].ino = sb->qf_ino[qtype];
-		i++;
-	}
-
-	/* update root */
-	nat_blk->entries[get_sb(root_ino)].block_addr = cpu_to_le32(
-		get_sb(main_blkaddr) +
-		c.cur_seg[CURSEG_HOT_NODE] * c.blks_per_seg);
-	nat_blk->entries[get_sb(root_ino)].ino = sb->root_ino;
-
 	/* update node nat */
 	nat_blk->entries[get_sb(node_ino)].block_addr = cpu_to_le32(1);
 	nat_blk->entries[get_sb(node_ino)].ino = sb->node_ino;
@@ -1660,7 +1640,7 @@  static int f2fs_create_root_dir(void)
 	}
 #endif
 
-	err = f2fs_update_nat_root();
+	err = f2fs_update_nat_default();
 	if (err < 0) {
 		MSG(1, "\tError: Failed to update NAT for root!!!\n");
 		goto exit;