- 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 <c...@kernel.org>
---
 mkfs/f2fs_format.c | 24 ++----------------------
 1 file changed, 2 insertions(+), 22 deletions(-)

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;
-- 
2.40.1



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to