summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/node.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk.kim@samsung.com>2014-02-17 12:44:20 +0900
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2014-02-17 14:58:53 +0900
commitb63da15e8b475245026bdf2096853683f189706b (patch)
tree1d6bf8304f3aa161a09dbd24be7059a7c99cc18a /fs/f2fs/node.c
parent942e0be6219cc80384eb961feb963cab275bcbbf (diff)
downloadlinux-stable-b63da15e8b475245026bdf2096853683f189706b.tar.gz
linux-stable-b63da15e8b475245026bdf2096853683f189706b.tar.bz2
linux-stable-b63da15e8b475245026bdf2096853683f189706b.zip
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: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/node.c')
-rw-r--r--fs/f2fs/node.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 7689f9105dc1..d452185c5eaa 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -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;