f2fs: fix the calculation of max_nids
authorJaegeuk Kim <jaegeuk.kim@samsung.com>
Mon, 17 Feb 2014 03:44:20 +0000 (12:44 +0900)
committerJaegeuk Kim <jaegeuk.kim@samsung.com>
Mon, 17 Feb 2014 05:58:53 +0000 (14:58 +0900)
Total nids that f2fs can use should not include 0, nid for node inode, and nid
for meta inode.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
fs/f2fs/node.c

index 7689f9105dc1270ee3e5e9349dda14d0184a799f..d452185c5eaadb32aff5454d2aba99f397fe4361 100644 (file)
@@ -1811,7 +1811,9 @@ static int init_node_manager(struct f2fs_sb_info *sbi)
        /* segment_count_nat includes pair segment so divide to 2. */
        nat_segs = le32_to_cpu(sb_raw->segment_count_nat) >> 1;
        nat_blocks = nat_segs << le32_to_cpu(sb_raw->log_blocks_per_seg);
-       nm_i->max_nid = NAT_ENTRY_PER_BLOCK * nat_blocks;
+
+       /* not used nids: 0, node, meta, (and root counted as valid node) */
+       nm_i->max_nid = NAT_ENTRY_PER_BLOCK * nat_blocks - 3;
        nm_i->fcnt = 0;
        nm_i->nat_cnt = 0;
 
This page took 0.026965 seconds and 5 git commands to generate.