Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b63da15e authored by Jaegeuk Kim's avatar Jaegeuk Kim
Browse files

f2fs: fix the calculation of max_nids



Total nids that f2fs can use should not include 0, nid for node inode, and nid
for meta inode.

Signed-off-by: default avatarJaegeuk Kim <jaegeuk.kim@samsung.com>
parent 942e0be6
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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;